根据条件,间隔一定时间执行同一段代码
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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