Skip to content
JavaScript·Advanced·Coding·1 min read

What is currying?

Short interview answer

Currying transforms a function of multiple arguments into a sequence of functions that each consume one argument, such as f(a, b) becoming f(a)(b). It differs from partial application, which fixes some arguments and may leave a function accepting several remaining arguments.

Example

JavaScript
const add = (a) => (b) => (c) => a + b + c;add(1)(2)(3); // 6
const add10 = add(10);add10(5)(1);  // 16 — the first stage is reused

Key takeaway

Explain the underlying mental model clearly, then support it with a concrete example and its trade-offs.

← Back to Currying

Related questions