JavaScript · Middle · Question 14 of 75

What is currying?

const add = a => b => a + b;
add(2)(3); // 5

Explanation

Currying relies on closures: each function remembers the argument passed to it. It lets you create specialized functions (const add10 = add(10)). Partial application (bind with arguments) is a close but not identical idea.

Further reading

Problem with a question

JavaScript · Middle · question 14

Test yourself

Take the JavaScript · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz