Array.prototype.forEach(callback) 的 callback 到底执行了几次?
原文链接事情的起源是这样的, 同事发给我两段代码, 如下:var a = [1, 2, 3, 1, 2, 3];a.forEach((item, index) => { console.log(index, item); if (item === 1) { a.splice(index, 1); }});// 输出// 0 1// 1 3//...