Javascript examples for Statement:for
Manage to sleep inside a loop
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){//w w w . ja va 2 s.com (function() { var i = 0, action = function() { document.write(i + "<br>"); i++; if (i < 10) { setTimeout(action, 1000); } }; setTimeout(action, 1000); })(); } </script> </head> <body> </body> </html>