In idiomatic JavaScript, processing lists of data is rarely done with for loops. Instead, we use declarative methods that describe what we want to do, rather than how to do it. The three most important methods are map, filter, and reduce.
1. Transformation with Map
The .map() method creates a new array by applying a function to every element in the calling array. It is used when you want to transform elements 1-to-1.
2. Selection with Filter
The .filter() method creates a shallow copy of a portion of a given array, filtered down to just the elements from the given array that pass the test implemented by the provided function.
3. Aggregation with Reduce
The .reduce() method executes a user-supplied "reducer" callback function on each element of the array, in order, passing in the return value from the calculation on the preceding element. It reduces the array to a single value.
4. Method Chaining
These methods can be chained together to perform complex operations in a readable, linear flow.