JSFiddle - React, Tailwind, and code Playground
by orchid1
JavaScript
function curry(a, b) {
if (typeof b === "undefined") {
return function(b) {
return 'the curried function value is ' + (a + b);
};
}
return 'the value of the non curried function is '+ (a + b);
}
//this creates the closure
var c = curry(1);
//this uses the value in the closure
alert(c(2));//returns 3
//now try passing both arguments
alert(curry(2,4));//returns 6