Javascript examples for Browser Object Model:Window setTimeout
SetTimeout in do while loop
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){// w w w . j a v a 2 s . c o m var counter = 0; var interval = setInterval(function(){ counter++; if(counter === 5){ clearInterval(interval); } console.log("hello"); }, 2000); } </script> </head> <body> </body> </html>