function mySetInterval(fun,interval) {
setTimeout(function () {
fun();
setTimeout(arguments.callee, interval);
}, interval)
};
function func() {
console.log('1');
}
mySetInterval(func,1000);
function mySetInterval(fun,interval) {
setTimeout(function () {
fun();
setTimeout(arguments.callee, interval);
}, interval)
};
function func() {
console.log('1');
}
mySetInterval(func,1000);
本文标题:使用setTimeout实现setInterval
本文链接:https://www.haomeiwen.com/subject/xrtpgxtx.html
网友评论