Skip to content

Instantly share code, notes, and snippets.

@gartenfeld
Created October 27, 2015 07:49
Show Gist options
  • Select an option

  • Save gartenfeld/7be4cb249175b120317f to your computer and use it in GitHub Desktop.

Select an option

Save gartenfeld/7be4cb249175b120317f to your computer and use it in GitHub Desktop.
Since JSHint says not to make functions inside a loop..
var delay = function(i) {
setTimeout(function() {
console.log(i);
}, i * 100);
};
for (var i = 1; i <= 10; i++) {
delay(i);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment