Created
March 19, 2016 21:41
-
-
Save JasonDeving/3333ab7c618d38e3ff9b to your computer and use it in GitHub Desktop.
closure example refactored
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 add = function(num){ | |
var addToNum1 = function(num2){ | |
return num + num2; | |
} | |
return addToNum1; | |
}; | |
var add5 = add(5); | |
add5(2); // 7 | |
add5(3); //8 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment