Grokking Advanced JavaScript
0% completed
Currying
A function such as add(x, y) takes all of its arguments in one call. The same work can be split into a chain of functions that each take one argument: the first call receives x and returns a function, and the second call receives y and returns the result. Turning a function of several arguments into such a chain of one-argument functions is called currying, after the logician Haskell Curry.
From add(x, y) to add(x)(y)
The curried version of a two-argument function is a function that returns another function.
function curriedFunction(a) {
.....
.....
.....
Like the course? Get enrolled and start learning!
Reading Progress
0%