DEV Community

Discussion on: Useful JS array methods to level up your game!

Collapse
 
cairnswm profile image
William Cairns

I find staticMap() a very underrated function

Collapse
 
thesanjeevsharma profile image
Sanjeev Sharma

I am not sure what you're talking about. Can you provide a reference? I'd love to read about it.

Collapse
 
cairnswm profile image
William Cairns

Sorry, its flatMap

developer.mozilla.org/en-US/docs/W...

The array.map() returns a single item per item in the array. with flatMap you can return multiple or no items per item in the array you are iterating over

Thread Thread
 
thesanjeevsharma profile image
Sanjeev Sharma • Edited

Yes! I've used it recently. But I think it's for specific cases only. Not something you'd use every day. But again, really useful and a pretty one. ✌️

Maybe, I'll make a Part 2 for these kinds of methods. 😉