JavaScript · Middle · Question 14 of 75
What is currying?
const add = a => b => a + b;
add(2)(3); // 5- ✓Correct answer: Turning a function of many arguments into a chain of single-argument functions
- 2Calling a function with a delay until the next event loop tick
- 3Combining several functions into one that runs them in parallel
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.