Currying and Functional Composition Quiz
Compose, curry, memoize, and partially apply: the higher-order toolkit that turns small JavaScript functions into reusable building blocks.
Question Bank
Hard
JavaScript
quiz
currying
composition
higher-order-functions
419 views
11
Implement curry(fn) so that the curried function can be called with any combination of single-argument or multi-argument applications until all of fn.length arguments are collected.
Examples
Example 1:
Input: const sum = curry((a, b, c) => a + b + c); sum(1)(2)(3); sum(1, 2)(3); sum(1)(2, 3); sum(1, 2, 3)
Output: 6, 6, 6, 6
Explanation: The wrapper keeps accumulating args and only calls `fn` once `args.length >= fn.length`.5 more questions, with full solutions and explanations, are available for premium members.
Upgrade to Premium