欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

javascript (用setTimeout而非setInterval)

 更新時(shí)間:2011年12月28日 23:56:48   作者:  
javascript (用setTimeout而非setInterval)如果用setInterval 可能出現(xiàn) 下次調(diào)用會(huì)在前一次調(diào)用前調(diào)用
復(fù)制代碼 代碼如下:

var num = 0;
var max = 10;
function incrementNumber() {
num++;
//if the max has not been reached, set another timeout
if (num < max) {
setTimeout(incrementNumber, 500);
} else {
alert(“Done”);
}
}
setTimeout(incrementNumber, 500);

如果用setInterval 可能出現(xiàn) 下次調(diào)用會(huì)在前一次調(diào)用前調(diào)用 (

True intervals are rarely used in production environments because it ' s possible that one interval will begin before the previous one has finished executing)

相關(guān)文章

最新評(píng)論