What is the difference between currying and partial application?
JavaScriptThe short answer
Currying transforms a function into a chain of single-argument functions: f(a, b, c) becomes f(a)(b)(c). Partial application fixes some arguments upfront and returns a function for the rest: f(a, b, c) becomes g(c) where a and b are already set. Currying always produces unary functions, partial application can fix any number of arguments.
Side by side
function add(a, b, c) { return a + b + c;}// Currying — one argument at a timeconst curried = (a) => (b) => (c) => a + b + c;curried(1)(2)(3); // 6// Partial application — fix some arguments upfrontconst partial = add.bind(null, 1, 2);partial(3); // 6The key differences
| Currying | Partial Application | |
|---|---|---|
| Arguments | Always one at a time | Fix any number at once |
| Result | Chain of unary functions | One function with fewer arguments |
| Flexibility | Must call step by step | Pre-fill whatever you want |
When to use which
Currying works well when you want to create a pipeline of transformations or when a library expects single-argument functions:
const add = (a) => (b) => a + b;[1, 2, 3].map(add(10)); // [11, 12, 13]Partial application works well when you want to create specialized versions of a function:
const log = (level, message) => console.log(`[${level}] ${message}`);const logError = log.bind(null, 'ERROR');const logInfo = log.bind(null, 'INFO');logError('Something broke'); // [ERROR] Something brokelogInfo('App started'); // [INFO] App startedIn practice
In everyday JavaScript, partial application (often through bind or closures) is more common than currying. Currying is more common in functional programming libraries.
Interview Tip
Show both side by side with the same function. The key distinction is: currying always takes one argument per call, partial application takes any number. This is a quick comparison question — do not over-explain.
Why interviewers ask this
Many candidates confuse the two terms. Interviewers ask this to see if you understand the precise difference. It also tests your understanding of closures and higher-order functions.