function forEach(array, action) {
for(i = 0; i <= array.length; i++) {
action(array[i]);
}
};
console.log(forEach([1, 2, 3], console.log));
How come this code executes the way I want it to in the codeacademy javascript console, but not the one in chrome? In chrome it keeps saying illegal invocation so I'm not sure if I'm doing some wrong or not. Any help please?