Skip to content

Instantly share code, notes, and snippets.

@daronwolff
Last active May 20, 2016 19:29
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/5372e09eec9aefd961925687fb4ee246 to your computer and use it in GitHub Desktop.
Save daronwolff/5372e09eec9aefd961925687fb4ee246 to your computer and use it in GitHub Desktop.
Write two binary functions "add" and "mul", that take two numbers and return their sum and product
"use strict";
var add = (function(a){
return function (b){
return a + b;
}
});
var mul = (function(a){
return function(b){
var total = a * b;
return total;
}
});
console.log(add(1)(2));
console.log(mul(10)(2));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment