clearInterval
-
clearInterval
-
setInterval
-
setTimeout
-
setInterval
returns an identifier that can later be used to stop the scheduled process. -
clearInterval
will stop a scheduled process.
var intervalId = setInterval(function() {
console.log("world");
}, 1000);
setTimeout(function() {
console.log("Calling clearInterval");
clearInterval(intervalId);
}, 3030);
console.log("hello");
$ node examples/basic/with_clearinterval.js
hello
world
world
world
Calling clearInterval