/*
Foreach helper function
callback
Function to execute for each element, taking three arguments:
currentValue
The current element being processed in the array.
index
The index of the current element being processed in the array.
array
The array that forEach() is being applied to.
*/
var forEach = function(array, callback){
var currentValue, index;
for (i = 0; i < array.length; i += 1) {
currentValue = array[i];
index = i;
callback(currentValue, i, array);
}
}
// For each helper function
var forEach = function(array, callback){
var currentValue, index;
var i = 0;
for (i; i < array.length; i += 1) {
if(typeof array[i] == "undefined"){
currentValue = null;
} else {
currentValue = array[i];
}
index = i;
callback(currentValue, i, array);
}
}