Created
June 24, 2020 04:04
-
-
Save night-fury-rider/bb32be48a600be679bd0596169258126 to your computer and use it in GitHub Desktop.
Closure inside loop
This file contains hidden or 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<5; i++) { | |
| (function (i){ | |
| setTimeout(function() { | |
| console.log(i); | |
| }, 0); | |
| })(i); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment