JSworkingevergreen
Functional JavaScript
Data in, data out.
OOP has its place, but functional patterns — pure functions, immutability, composition — produce code that's easier to test and easier to reason about.
Pure functions and the big four
JSintro Press Run to execute
Each of the big four collapses a loop into one expression: map squares every element to [0,1,1,4,9,25,64,169], filter keeps the even ones ([0,2,8]), reduce folds the array down to its sum 33, and flatMap maps-then-flattens nested arrays into [1,2,3,4] — and because square is pure, none of these mutate fib.