Skip to content

Instantly share code, notes, and snippets.

@daronwolff
Created May 20, 2016 20:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save daronwolff/ad9b174ec02de35451d961a0ec9da310 to your computer and use it in GitHub Desktop.
Save daronwolff/ad9b174ec02de35451d961a0ec9da310 to your computer and use it in GitHub Desktop.
var add = (function(a) {
return function(b) {
return a + b;
}
});
var mul = (function(a) {
return function(b) {
var total = a * b;
return total;
}
});
function applyf(f) {
return f;
}
addf = applyf(add);
console.log(addf(2)(3)); // 5
console.log(applyf(mul)(2)(3)); // 6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment