Aryan PrajapatKnowledge Contributor
Explain the working of timers in JavaScript?
Explain the working of timers in JavaScript?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Questions | Answers | Discussions | Knowledge sharing | Communities & more.
Timers are used to execute a bit of code at a set time and repeat the bit of code in a given interval.
Those working are done by using functions setTimeout, setInterval, clear interval.
Working of Functions:
The setTimeout(function, delay) function is used to start a timer, which calls a particular function after the, particularly mentioned delay.
The setInterval(function, delay) function is used to repeatedly execute the given function in the said delay and only stops when it is cancelled.
The clearInterval(id) function instructs or indicates the timer to stop (for stopping the given or mentioned function).
The whole timers are operated within a single thread, and for his events might wait or queue up, they wait for their execution.