22
rated 0 times
[
23]
[
1]
/ answers: 1 / hits: 55811
/ 11 Years ago, sat, april 6, 2013, 12:00:00
I have an array like so
var updates = [];
I then add stuff to the array like this
updates[func1] = function () { x += 5 };
When I call the functions with a for loop it works as expected
for(var update in updates) {
updates[update]();
}
But when I use the forEach it doesn't work!?
updates.forEach(function (update) {
update();
});
forEach definitely works in my browser which is google chrome, what am I doing wrong?
More From » arrays