DEV Community

Discussion on: Avoid slow Javascript code

Collapse
 
val_baca profile image
Valentin Baca

It's been a while, but I actually ran the numbers on micro-optimizing the array-for-loop. Granted, this was pre-ES6 and the jsperf site is now gone, but I found that this was the fastest loop:

for (var i = 0, len = myArray.length; i < len; ++i) {
  // blah blah
}
Enter fullscreen mode Exit fullscreen mode

stackoverflow.com/questions/534942...