Applying delay between iterations for loop - Javascript Statement

Javascript examples for Statement:for

Description

Applying delay between iterations for loop

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
    window.onload=( function() {//from  w ww  . jav a 2 s  . c o m
for(i = 1; i <= 3; i++){
    (function(i){
        setTimeout(function(){
            console.log(i);
        }, 1000 * i);
    }(i));
}
    });

      </script> 
   </head> 
   <body>  
   </body>
</html>

Related Tutorials