What Are Currying Functions?

This lesson briefly explains the concept of currying functions in JavaScript.

We'll cover the following

Currying is fundamental in functional programming.

Currying: Definition #

Currying transforms a function into a sequence of nesting functions. Basically, it converts a function from this:

f(a,b,c)

to this:

f(a)(b)(c)

It involves taking a function with multiple arguments and returning a sequence of nested functions, each taking a single argument, eventually resolving to a value.

Example #

Let’s take a look at an example. Let’s write a simple function for multiplying three values:

Level up your interview prep. Join Educative to access 80+ hands-on prep courses.