Skip to content

Instantly share code, notes, and snippets.

@zymiboxpay
Created April 11, 2017 07:12
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
根据条件,间隔一定时间执行同一段代码
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