← Back to Roadmap

Currying

Medium

In plain terms

Transform fn(a,b,c) into fn(a)(b)(c). Partial application. Returns function until all args provided. Used in functional style.

What you need to know

  • Partial application
  • Returns functions
  • Functional style

Try it yourself

Copy the code below and run it in your browser console or a code editor:

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

Learn more

Dive deeper with these trusted resources: