Skip to content

Instantly share code, notes, and snippets.

@gurucharanmk
Created April 22, 2016 13:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gurucharanmk/5071d37bb5af61a93562fbe024a975de to your computer and use it in GitHub Desktop.
Save gurucharanmk/5071d37bb5af61a93562fbe024a975de to your computer and use it in GitHub Desktop.
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