DEV Community

Discussion on: My Top 3 JavaScript Array Methods

Collapse
 
matthewbdaly profile image
Matthew Daly

Mine would probably be map(), sort() and filter(), with an honourable mention for reduce().

Because I use React a lot, I often have to loop through a list of sub components to render. For that, map() is indispensable in transforming an array from a list of Javascript objects into React components. It's also common to have to sort and filter them.

On occasion I also need to produce some form of aggregate from array data, and the combination of map() and reduce() can be very powerful for that.

Collapse
 
karataev profile image
Eugene Karataev

+1 for map. It's a really great and clean method to transform array data structures. Use it all the time, no matter if it's a React component or a vanilla javascript.