forEach (callback, target) Object
public
Iterates through the enumerable, calling the passed function on each item. This method corresponds to the forEach()
method defined in JavaScript 1.6.
The callback method you provide should have the following signature (all parameters are optional):
function(item, index, enumerable);
-
item
is the current item in the iteration. -
index
is the current index in the iteration. -
enumerable
is the enumerable object itself.
Note that in addition to a callback, you can also pass an optional target object that will be set as this
on the context. This is a good way to give your iterator function access to the current object.
Parameters:
-
callback
Function
- The callback to execute
-
target
[Object]
- The target object to use
Returns:
-
Object
- receiver
Please login to continue.