var num = [1, 2, 3, 4, 5, 6], len = num.length, index = 0;var timer = setInterval(function () { if(index >= len) { clearInterval(timer); } else { console.log(num[index]); } index++;}, 1000);
本文共 270 字,大约阅读时间需要 1 分钟。
var num = [1, 2, 3, 4, 5, 6], len = num.length, index = 0;var timer = setInterval(function () { if(index >= len) { clearInterval(timer); } else { console.log(num[index]); } index++;}, 1000);
转载于:https://www.cnblogs.com/vali/p/7753778.html