Created
September 10, 2010 17:45
-
-
Save neall/574058 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
var myMultiplierMaker = function(factor) { | |
var returnFunction = function(otherFactor) { | |
return factor * otherFactor; | |
} | |
return returnFunction; | |
} | |
var timesFive = myMultiplierMaker(5); | |
var timesSeven = myMultiplierMaker(7); | |
console.log(timesFive(2)); // logs 10 | |
console.log(timesSeven(2)); // logs 14 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment