In this post, a timer has been shown that shows the countdown and its colour/message gets changed after every specific period of time.
setTimeout(function, milliseconds, parameter1, ...)
Parameter: It accept some parameters which are specified below-
- function: It is the function that will be executed.
- milliseconds: It is the number of milliseconds to wait before executing the code. It is optional and its default value is zero(0).
- parameter1: It is additional parameters to pass to the function and it is optional.
Return Value: It returns a number representing the ID value of the timer that is set.
After clicking on the run button-
After some time-
When Less than 1 minute is left-
When timer is up-
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.