Created
March 19, 2016 21:40
-
-
Save JasonDeving/fe2d600532e6060eb73a to your computer and use it in GitHub Desktop.
Closure Example 2
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 num1 = num; | |
| var addToNum1 = function(num2){ | |
| return num1 + 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