Last active
May 20, 2016 19:29
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"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