Run details:
Mozilla/5.0 (Linux; Android 9; Mi A2 Lite) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Mobile Safari/537.36
Chrome Mobile 80
Android
Mobile
5 years ago
Test name Executions per second
for 10175.5 Ops/sec
foreach 407580.6 Ops/sec
some 409420.6 Ops/sec
for..of 17188.7 Ops/sec
Script Preparation code:
AخA
 
var array = new Array(100);
Tests:
  • for

     
    for (var i = 0; i < array.length; i++) {
      array[i];
    }
  • foreach

     
    array.forEach(function(i) {
      array[i];
    });
  • some

     
    array.some(function(i) {
      array[i];
    });
  • for..of

     
    for (var i of array) {
      array[i];
    }