Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function outerFunction() {
- var counter = 0;
- return function () {
- counter++;
- console.log(counter);
- }
- }
- var innerReferenceFunction = outerFunction();
- innerReferenceFunction(); // Console logs : 1
- innerReferenceFunction(); // Console logs : 2
- innerReferenceFunction(); // Console logs : 3
Add Comment
Please, Sign In to add comment