Fundamentals / Arrays
Arrays: map, filter, reduce
Transform, select, and combine — without writing manual loops.
`map` produces a new array by transforming every element. `filter` produces a new array keeping only elements that pass a test. `reduce` collapses an array down to a single value by carrying an accumulator through each element. All three leave the original array untouched.
Codeeditable — Run executes your edits
Loading...
Console
Output will appear here
Visualization
State
Step through — the console panel shows what's happening
Why?
map calls your function once per element and collects the return values into a brand-new array — the original array is never mutated.