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-