Page Loading...
Run
Break Lines
Result
<!DOCTYPE html> <html> <head> <style> /*Write CSS Here*/ </style> </head> <body> <!--HTML Goes here--> <script> var timerId = setInterval(myFunction, 5000); var counter = 0; function myFunction(){ // Writes Hello world after every 5 seconds. document.write('Hello world!<br>'); counter = counter + 1; if(counter>=5){ // Clear setInterval() method clearInterval(timerId); document.write('Timer stopped'); } // Write your stuff here } </script> </body> </html>