Lesson 21 — Currying
One argument at a time
Currying turns a function that takes two arguments, f(a, b), into a function that takes one and returns another: f(a)(b). The first call "remembers" a through a closure. That lets you make specialised helpers from a general one.
const add = (a) => (b) => a + b;
const addTen = add(10);
console.log(addTen(5)); // 15
Why it matters: this style is everywhere in functional code and libraries (event handlers, configured validators, Redux middleware).
Rewrite multiply so multiply(3)(4) prints 12 and triple(10) prints 30.
Run your code — when the output matches the task, you will see a green check. Then mark the lesson complete.
A quick 3-question quiz on this lesson — instant feedback.
Ready for more? Optional paid resources that pick up where this lesson leaves off.
Some links on this page are affiliate links: we may earn a commission at no extra cost to you. As an Amazon Associate I earn from qualifying purchases.
Project-based JavaScript Intermediate courses if you want a structured paid path after the free lessons. Wait for a sale — prices drop often.
Browse on Udemy →Search Amazon for JavaScript Intermediate books — check the publication year so the examples match current versions.
Search Amazon →