9 ms·
I think the point is the while loop runs faster in Chrome. But the for loop is inefficiently written; it checks the array length every time. Change it to `for(v
by AshleysBrain 13y ago
I think the point is the while loop runs faster in Chrome. But the for loop is inefficiently written; it checks the array length every time. Change it to `for(var len = items.length; j<len; ++j)` and it's faster again. tl;dr - badly written for loops are slow.