Fundamentals

Arrays & array methods

The essential iteration methods: map, filter and reduce.

beginner Freshers

Arrays come with higher-order methods that replace most manual for loops with clear, declarative transformations.

map is a factory line reshaping each item, filter is a bouncer letting some through, and reduce is a cashier totalling everything into one receipt.

Key concepts

1
map returns a new array by transforming every element. filter returns a new array with only the elements that pass a test. reduce boils an array down to a single value (a sum, an object, another array) using an accumulator.
mapfilterreduce
2
All three are immutable — they return new arrays and leave the original untouched, which is why they pair so well with modern UI frameworks.
immutable