Created
September 20, 2019 14:32
-
-
Save giovanniantonaccio/5b6911db08300dc59cd95818ab9cb449 to your computer and use it in GitHub Desktop.
SetTimeout Loop Fix
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
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