Why is there no forEach method on Object in ECMAScript 5?
问题 ECMAScript 5's array.forEach(callback[, thisArg]) is very convenient to iterate on an array and has many advantage over the syntax with a for: It's more concise. It doesn't create variables that we need only for the purpose of iterating. It's creates a visibility scope for the local variables of the loop. It boosts the performance. Is there a reason why there is no object.forEach to replace for(var key in object) ? Of course, we could use a JavaScript implementation, like _.each or $.each but