Lesson 36 of 55 · javascript
Functional Programming Concepts in JS
Duration: 10 mins
FP encourages pure functions, immutability, and higher‑order functions.
map,filter,reduce– already covered.- Immutability – use
Object.freeze, spread ({...obj}), or libraries like Immer. - Currying – turning a function with multiple arguments into a chain of single‑argument functions.
Example: Simple curry
const add = a => b => a + b;
const add5 = add(5);
console.log(add5(2)); // 7