3000 explained code solutions for 75 technologies


javascriptHow to stop setTimeout execution


var timeout = setTimeout(function() {}, 1000);
clearTimeout(timeout);ctrl + c
var timeout

stores timeout ID

setTimeout(function() {}, 1000)

declare test timeout call of some function

clearTimeout(timeout)

stop previously launched timeout by ID