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.
Five lookups over a product list. This is map, filter, find and reduce, and nothing else.
Every function returns the right value, including for inputs that match nothing.
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.