Everything looks great, one thing that I think you don't need to do is spread the array for filtering. Filter doesn't mutate the array, so it's a bit of a waste of memory.
Full Stack Functional Programmer focused on Accessibility, Testing, and Documentation/Technical Writing. Trying to be less clever and more kind. He/Him
Hey Rodrigo, do you mean the spread of the Combination object? IIRC, I spread into an array because the filter method isn't available on the combination directly.
But maybe there's a more efficient way to do that?
Full Stack Functional Programmer focused on Accessibility, Testing, and Documentation/Technical Writing. Trying to be less clever and more kind. He/Him
No worries. I didn't even check to see if it implemented toArray(). That's probably the clearer way to express that intent. I'll use that instead. Thanks!
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Everything looks great, one thing that I think you don't need to do is spread the array for filtering. Filter doesn't mutate the array, so it's a bit of a waste of memory.
Hey Rodrigo, do you mean the spread of the
Combination
object? IIRC, I spread into an array because the filter method isn't available on the combination directly.But maybe there's a more efficient way to do that?
You are right, this object doesn't generate a pure array.
it has the toArray function, but it does the same you did there.
I should have checked this before commenting
No worries. I didn't even check to see if it implemented
toArray()
. That's probably the clearer way to express that intent. I'll use that instead. Thanks!