Array methodsbeginner
map, filter, find and reduce replace almost every loop you would otherwise write — knowing which one returns what is the single highest-leverage thing in JavaScript.
Write one function that returns exactly what a GROUP BY query would. No loops.
The same rows, in the same order, as the SQL query would return.
Published in full, before you start — every point is one of these and there is nothing else. Each one runs your code; it is not a search for keywords.
map, filter, find and reduce replace almost every loop you would otherwise write — knowing which one returns what is the single highest-leverage thing in JavaScript.
sort() and reverse() change the array you gave them, which is how a filter quietly reorders the caller's data — copy first, and the bug never exists.