i have a setInterval() function which is used as follows
setInterval(function(){
if(window.document.drops.isFinished()){
//I want to exit the setInterval() on executing this if
}
},1000);
or tell me what is the method to exit.(In java we use System.exit(0))
var timerId = setInterval(function(){
if(window.document.drops.isFinished()){
clearInterval(timerId);
}
},1000);
If the if
it's not the last thing in the function and you want to "break" the execution, maybe you want to also add a return;
statement after the clearInterval
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.