Created
April 22, 2016 13:05
-
-
Save gurucharanmk/5071d37bb5af61a93562fbe024a975de to your computer and use it in GitHub Desktop.
This file contains 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 funcArray = []; | |
for (var i = 0; i < 10; i++) { | |
funcArray.push(function() { console.log(i); }); | |
} | |
console.log(i); // Accessible but undefined | |
funcArray.forEach(function(func) { | |
func(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment