DEV Community

Discussion on: Understanding Array.prototype.flatMap

Collapse
 
tanmayrajani profile image
Tanmay Rajani

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..

Collapse
 
laurieontech profile image
Laurie

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...

Collapse
 
tanmayrajani profile image
Tanmay Rajani

Makes sense. Thanks for sharing!