If I have more than one operations to do on an array, I subconsciously go to reduce everytime. It's better than remembering these separate functions I think. Not sure if it's the best option complexity-wise..
Software dev at Netflix | DC techie | Conference speaker | egghead Instructor | TC39 Educators Committee | Girls Who Code Facilitator | Board game geek | @laurieontech on twitter
If I have more than one operations to do on an array, I subconsciously go to
reduce
everytime. It's better than remembering these separate functions I think. Not sure if it's the best option complexity-wise..I think it depends. The Mozilla docs actually mention that for large arrays that option isn’t as efficient.
developer.mozilla.org/en-US/docs/W...
Makes sense. Thanks for sharing!