且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在underscore.js中的_.each循环的每次迭代中添加延迟?

更新时间:2023-10-30 18:04:46

您不需要额外的IIFE

You don't need extra IIFE

_.each(this.rows, function (row, i) {
    setTimeout(function () {
        row.setChars(msg[i] ? msg[i] : ' ');
    }, 1000 * i);
});

因为你没有在显式的中为$ c做这件事$ c>循环。

since you're not doing it in an explicit for loop.