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.
Three functions that all quietly change the data they were given. Two are broken. Work out which.
All three return the right value, and none of the originals change.
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.
The shape an API returns is almost never the shape your UI wants; turning snake_case rows with flags into the objects your components render is most of frontend work.