Created
          April 9, 2017 05:53 
        
      - 
      
- 
        Save NigelEarle/4ed80db34818b2b90015f67e68ebab7d to your computer and use it in GitHub Desktop. 
    setTimeout() in for 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 < 10;i++) { | |
| (function(i) { | |
| setTimeout(function(){ | |
| console.log(i); | |
| }, 1000 * i); | |
| })(i); | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment