Test case details

Preparation Code

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

Test cases

Test #1

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

Test #2

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

Test #3

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

Test #4

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

Test #5

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

Test #6

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

Test #7

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

Test #8

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

Test #9

var i = -arr.length; while (i++) { someFn(i); }

Test #10

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

Test #11

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

Test #12

var i = arr.length; while (i--) { someFn(i); }