Answers for "empty settimeout"

20

js cleartimeout

var myVar;

function myFunction() {
  myVar = setTimeout(function(){ alert("Hello"); }, 3000);
}

function myStopFunction() {
  clearTimeout(myVar);
}
Posted by: Guest on February-19-2020
3

clear timeout js

The clearTimeout() method of the WindowOrWorkerGlobalScope mixin cancels a timeout previously established by calling setTimeout().
Posted by: Guest on July-12-2020
0

javascript Use clearTimeout() Method

// program to stop the setTimeout() method

let count = 0;

// function creation
function increaseCount(){

    // increasing the count by 1
    count += 1;
    console.log(count)
}

let id = setTimeout(increaseCount, 3000);

// clearTimeout
clearTimeout(id); 
console.log('setTimeout is stopped.');
Posted by: Guest on May-21-2022

Code answers related to "Javascript"

Browse Popular Code Answers by Language