2
這只是一個簡單的setInterval示例,我正在使用,但clearInterval並未停止setInterval。它計數通過0到負數。我如何完成這項工作並在0時停止?clearInterval不會停止傳遞0(倒數)
getMoreVideosCountdown = 10;
getMoreVideos = setInterval(function() {
console.log(getMoreVideosCountdown);
if (getMoreVideos <= 0) {
clearInterval(getMoreVideos);
}
getMoreVideosCountdown--;
},1000);
啊!!我需要做更好的檢查謝謝 – 2012-08-01 01:14:23