4 ms·
Their first example for (let _i = 0; _i < arr.length; _i++) { results.push(_f(arr[_i], _i, arr)); } This is recalculating length on each iteration
by Ihfhcub 9y ago
Their first example
for (let _i = 0; _i < arr.length; _i++) {
results.push(_f(arr[_i], _i, arr));
}
This is recalculating length on each iteration
- hajile 9y agoThe mystery of JIT optimization. The optimizer will turn that into a dereferenced register value. I remember reading that v8 used to add an extra instruction if you assigned the variable yourself.