Skip to content

Instantly share code, notes, and snippets.

@neall
Created September 10, 2010 17:45
Show Gist options
  • Save neall/574058 to your computer and use it in GitHub Desktop.
Save neall/574058 to your computer and use it in GitHub Desktop.
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