Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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.');
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #javascript #Use #Method
ADD COMMENT
Topic
Name
1+1 =