Curry example
Curry example
by Nirvanachain
HTML
<!--
Curry is to return a function from a function, binding values from the first function invokation so that they are available for the next invokation of the function.
-->
JavaScript
function curryAdd(num_1) {
return function(num_2) {
return num_1 + num_2;
}
}
var add = curryAdd(1);
console.log( add(5) ); // logs 6
console.log( curryAdd(1)(5) ); // logs 6