Practice
JavaScriptData StructuresReactConcepts
Sign in
← Back to problems

Curried Add

Modern JavaScriptmedium

Course · Section 17: Modern JavaScript Development: Modules, Tooling, and Functional · Lecture 294: Declarative and Functional JavaScript Principles

Implement `curriedSum(a, b, c)` by defining a curried `add` (a function returning a function returning a function) and calling it as `add(a)(b)(c)`.

Sample tests

Input: curriedSum(1, 2, 3)
Output: 6
Input: curriedSum(0, 0, 0)
Output: 0

+ 1 hidden test run on Submit.

Hints

Common pitfalls
  • Calling add(a, b, c) at once would not work with a curried function.
Approach & explanation (try first)

Currying turns a multi-argument function into a chain of single-argument calls.

Loading...
⌘/Ctrl + Enter

Run your code to see results.