Test case details

Preparation Code

<script> // Populate the base array var arr = []; for (var i = 0; i < 1000; i++) { arr[i] = i; } function someFn(ix) { return ix * 5 + 1 / 3 * 8; } </script>

Test cases

Test #1

var index = -1; var l = arr.length; while (index++ < l) { someFn(arr[index]); }

Test #2

var l = arr.length; while (l--) { someFn(arr[l]); }

Test #3

while (i = arr.pop()) { someFn(i); }

Test #4

var copy = arr.slice(0); while (i = copy.shift()) { someFn(i); }

Test #5

var a; while ((a = arr[i++]) !== undefined) { someFn(a); }

Test #6

while ((i = arr.shift()) !== undefined) { someFn(i); }

Test #7

while (i = arr.shift()) { someFn(i); }

Test #8

arr.forEach(function(v) { someFn(v) })

Test #9

for (var i in arr) { someFn(arr[i]); }

Test #10

var i = arr.length; if (i > 0) { do { someFn(arr[i]); } while (--i); }

Test #11

var i = arr.length - 1; do { someFn(arr[i]); } while (i--);

Test #12

for (var i = arr.length; i > 0; i--) { someFn(arr[i]); }

Test #13

for (var i = 0, len = arr.length; i < len; i++) { someFn(arr[i]); }

Test #14

var i = 0; while (i < arr.length) { someFn(arr[i]); i++; }

Test #15

for (var i = 0; i < arr.length; i++) { someFn(arr[i]); }