December 2013
Intermediate to advanced
384 pages
9h 54m
English
function myTimer () { alert("Timer Function Executed"); } var timerId = setTimeout(myTimer, 10000); clearTimeout(timerId); //timer will not execute
At any point before the time runs out and the code is executed, you can clear the timer by calling the clearTimeout(id) method using the ID returned from setTimeout(). Once the timer has been cleared, it does not execute. You need to keep track of the ID returned from setTimeout() using a variable.
Read now
Unlock full access