Learn JavaScript

Lesson 2 of 9 · Arrays and the Array Methods: The map, filter, reduce Pipeline

Module 7 · Arrays and the Array Methods: The map, filter, reduce Pipeline

Every Array Method, One by One, With What It Returns

Free with an accountReading

Amara's bookshop keeps its shelf as an array of titles. In one afternoon she adds new books, sells some from the middle, sorts the shelf by price, and looks one title up. Every one of those jobs is a single method call. The trick is knowing which method, and one more thing: does it change her shelf, or hand her a new one?

Checking what this lesson needs for you…

What is inside Every Array Method, One by One, With What It Returns

  1. push and pop: the fast end
  2. shift and unshift: the slow end
  3. Holes and the sparse trap
  4. slice copies, splice changes
  5. indexOf, includes, find and findIndex
  6. sort and its comparator
  7. reverse
  8. concat and the spread copy
  9. flat and flatMap
  10. join
  11. Array.from, Array.of and fill
  12. forEach, map, filter and reduce
  13. some and every
  14. The ES2023 copies: toSorted, toReversed, toSpliced and with
  15. Changes the array, or returns a new one