Skip to content

Instantly share code, notes, and snippets.

@zymiboxpay
Created April 11, 2017 07:12
Show Gist options
  • Save zymiboxpay/1359b0b987948aeaccb65f6cc984bd5b to your computer and use it in GitHub Desktop.
Save zymiboxpay/1359b0b987948aeaccb65f6cc984bd5b to your computer and use it in GitHub Desktop.
根据条件,间隔一定时间执行同一段代码
var i = 0;
setTimeout(function timeoutFunc(){
if(i < 10){
i ++;
console.log(i);
setTimeout(timeoutFunc, 1000);
}
}, 1000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment