Array Methods in JavaScript

Array Methods in JavaScript: map and filter, reduce, Sorting Arrays.

Updated

  1. map and filter (Apprentice): map turns every item of an array into something new, filter keeps only the items that pass a test, and chained together they turn raw data into exactly the list a screen needs.
  2. reduce (Journeyman): reduce walks through an array carrying a running total, so a whole list of scores, prices or plays boils down to one answer, such as a total, a count or a best score.
  3. Sorting Arrays (Apprentice): sort puts an array in order, but it compares items as text unless you give it a compare function, and it changes the array itself, so toSorted is the way to get a sorted copy and keep the original.