Run ❯
Get your
own
website
Result Size:
625 x 565
×
Change Orientation
Save Code
Change Theme, Dark/Light
Go to Spaces
<!DOCTYPE html> <html> <body> <h2>JavaSript setTimeout()</h2> <p id="demo">I will display when two, four, and six seconds have passed.</p> <script> setTimeout(myTimeout1, 2000) setTimeout(myTimeout2, 4000) setTimeout(myTimeout3, 6000) function myTimeout1() { document.getElementById("demo").innerHTML = "2 seconds"; } function myTimeout2() { document.getElementById("demo").innerHTML = "4 seconds"; } function myTimeout3() { document.getElementById("demo").innerHTML = "6 seconds"; } </script> </body> </html>