Run details:
Mozilla/5.0 (Linux; Android 10; SM-G965U1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.116 Mobile Safari/537.36 EdgA/46.06.4.5161
Chrome Mobile 77
Android
Mobile
3 years ago
Test name Executions per second
for 31319.2 Ops/sec
foreach 1386691.2 Ops/sec
some 1386675.6 Ops/sec
for..of 46714.1 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];
    }