Non-Mutating Array Methods
Non-mutating (or non-destructive) array methods return a new array or value without altering the original. These are the foundation of functional programming patterns in JavaScript and are essential in frameworks that require immutable state updates.
map(fn)
Transforms each element by applying fn and returns a new array of the same length. The original is untouched.
filter(fn)
Returns a new array containing only elements for which fn returns a truthy value.
reduce(fn, initialValue)
Accumulates all elements into a single value by repeatedly calling fn(accumulator, currentValue). Versatile — it can implement map, filter, grouping, and more.
find, findIndex, some, every
find(fn)— returns the first matching element (orundefined)findIndex(fn)— returns the index of the first match (or -1)some(fn)— returnstrueif at least one element passesevery(fn)— returnstrueonly if all elements pass