End of the world!
Create a web page with a timer that starts at 20 seconds and counts down to 0. When it reaches 0, display some large text that says, "The end of the world has come upon us" or something of the sort. (Feel free to get creative, too - change the background, use animations, etc.)
You'll need to use JavaScript's built-in setInterval
function to accomplish this. Here's the documentation.
Extra Credit:
- Show the countdown in this format 00:00:20 (hours minutes seconds).
- When the timer reaches 0, have the browser play a loud explosion sound.
- Test the timer with different times. If you code the timer to be one hour and thirty minutes the printed timer would look like: 01:30:00 when it starts. Have it correctly display the time when the hours, minutes, or seconds reach 0.