1.0 Single Argument Testing
The following tests forEach with one argument, the callback. It should print the contents of the array [2, 5, 9] alongside each index.


2.0 Two Argument Testing
The following tests forEach with two arguments, the callback and the applied "this" object. It should print the contents of the array.

3.0 Array Mutation Tests
These tests the affects of array mutation during execution of forEach.

3.1 Array Element Removal
This test removes elements from the array, these elements should thus not appear since forEach doesn't iterate over non-existing properties.


3.2 Array Element Addition
This test adds elements to the array, these elements should not appear since forEach uses the original length to create the range it iterates over. It should be identical to 1.0.


3.3 Array Element Changing
This test changes elements in the array, these elements should appear in their mutated form when reached by forEach.


4.0 Exception Test
This test uses a function that throws an exception, and thus halts the execution of forEach.


5.0 Wrong Type for Callback Test This test sends in incorrect types for the callback parameter of forEach. An exception should be thrown in each case. There should be 6 type errors (and no crashes!):


6.0 Behavior for Holes in Arrays
This test checks that holes in arrays (indexes which have been deleted or are not present) are not included in enumeration:


7.0 Return Value
This test checks that the return value of Array.prototype.forEach is undefined: