Skip to content

Instantly share code, notes, and snippets.

@giovanniantonaccio
Created September 20, 2019 14:32
Show Gist options
  • Save giovanniantonaccio/5b6911db08300dc59cd95818ab9cb449 to your computer and use it in GitHub Desktop.
Save giovanniantonaccio/5b6911db08300dc59cd95818ab9cb449 to your computer and use it in GitHub Desktop.
SetTimeout Loop Fix
for (var i = 0; i <= 3; i++) {
delay(i);
}
function delay(i) {
setTimeout(function() {
console.log(i);
}, 100);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment