Run details:
Mozilla/5.0 (Android 13; Mobile; rv:109.0) Gecko/112.0 Firefox/112.0
Firefox Mobile 112
Android
Mobile
2 years ago
Test name Executions per second
for 15945335.0 Ops/sec
foreach 9941641.0 Ops/sec
some 9823938.0 Ops/sec
for..of 1223458.9 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];
    }