Skip to content

Instantly share code, notes, and snippets.

@gurucharanmk
Created April 22, 2016 13:12
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/992fd0b39614b85cb2998b89fee713fa to your computer and use it in GitHub Desktop.
Save gurucharanmk/992fd0b39614b85cb2998b89fee713fa to your computer and use it in GitHub Desktop.
var funcArray = [];
for (let i = 0; i < 10; i++) {
funcArray.push(function() { console.log(i); });
}
//console.log(i); // Not accessible as i is block scope variable !!!
funcArray.forEach(function(func) {
func();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment