6 ms·
So the forEach magic that is so much faster is... a normal for loop: exports.forEach = function fastForEach (subject, fn, thisContext) { var length = sub
by Kiro 12y ago
So the forEach magic that is so much faster is... a normal for loop:
exports.forEach = function fastForEach (subject, fn, thisContext) {
var length = subject.length,
i;
for (i = 0; i < length; i++) {
fn.call(thisContext, subject[i], i, subject);
}
};
I knew that forEach was slower than a normal for loop but I was expecting something more.
- deleted 12y ago[deleted]