28
退出,我需要從一個運行區間,如果退出的條件是正確的:如何從setInterval的
var refreshId = setInterval(function() {
var properID = CheckReload();
if (properID > 0) {
<--- exit from the loop--->
}
}, 10000);
退出,我需要從一個運行區間,如果退出的條件是正確的:如何從setInterval的
var refreshId = setInterval(function() {
var properID = CheckReload();
if (properID > 0) {
<--- exit from the loop--->
}
}, 10000);
var refreshId = setInterval(function() {
var properID = CheckReload();
if (properID > 0) {
clearInterval(refreshId);
}
}, 10000);
如何從外循環做'clearInterval'? – TharinduLucky
只調用'clearInterval(intervalName)',例如:'var helloEverySecond = setInterval(function(){console.log(「hello」);},1000);''可以通過'clearInterval(helloEverySecond) –