Javascript examples for Browser Object Model:Window clearInterval
ClearInterval running timer
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){//from ww w .j a v a 2s.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>