re: My Top 3 JavaScript Array Methods VIEW POST

VIEW FULL DISCUSSION
 

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.

 

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

code of conduct - report abuse