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:
You have to remember that every object in javascript inherits from Object
. Not every object in javascript needs to have it's properties iterated. Those are mostly confined to data model objects. Adding the forEach method will only bulk up the prototype of every object unnecessarily.
If you currently see the Object and it's methods, they are present only to identify the object, or to distinguish one object from another.