Suggest an editImprove this articleRefine the answer for “Currying”. Your changes go to moderation before they’re published.Approval requiredContentWhat you’re changing🇺🇸EN🇺🇦UAPreviewTitle (EN)Short answer (EN)**Currying** is the process of transforming a function that takes several arguments into a sequence of functions, each of which takes only one argument. **Key point:** currying turns `f(a, b, c)` into `f(a)(b)(c)`, so you can call the function in parts and reuse partial calls.Shown above the full answer for quick recall.Answer (EN)Image**Currying** is the process of transforming a function that takes several arguments into a sequence of functions, each of which takes **only one argument**. --- ### Example: A regular function: ```javascript function sum(a, b) { return a + b; } sum(2, 3); // 5 ``` After currying: ```javascript function curriedSum(a) { return function (b) { return a + b; }; } curriedSum(2)(3); // 5 ``` --- ### How it works: - `curriedSum(2)` returns a new function that "remembers" the value `a = 2`. - That function then waits for the second argument `b`. - When we call it with `3`, it returns the result `2 + 3`. --- ### Why currying is needed: 1. **Reusing partially applied functions** ```javascript const add10 = curriedSum(10); add10(5); // 15 add10(7); // 17 ``` 2. **Simplifies function composition** - useful in functional programming. 3. **Improves code readability and flexibility**, especially in libraries like Lodash or Ramda. --- ### In short: > Currying turns the function `f(a, b, c)` into `f(a)(b)(c)`, > so it can be called in parts and partial calls can be reused.For the reviewerNote to the moderator (optional)Visible only to the moderator. Helps review go faster.