Test name | Executions per second |
---|---|
traditional for loop | 18772.7 Ops/sec |
for ... of | 17825.6 Ops/sec |
const arr = Array(10000).fill(1);
let sum = 0;
for (let i = 0; i < arr.length; i++) {
sum += i;
}
const arr = Array(10000).fill(1);
let sum = 0;
for (const el of arr) {
sum += el;
}