Let's say this is an attempt to bring some new, easy to implement, method for the native Object.prototype Specially about forEach, the most used Array.prototype method out there, it's quite clear JS developers would like to have similar method to iterate over objects, as key:value pairs rather than index:value.
Almost every framework/library out there has an "error prone" each(obj, callback) method, able to automagically recognize if the passed obj is an array, an arrayLike, or an object. A classic failing scenario is a function used as object, where the length property won't mean it's an arrayLike entity. As summary, I wonder if this proposal could make things more explicit, easy to remember, and faster, if implemented natively: https://gist.github.com/1410420 where more details about the "why" and "how", through examples, are explained in my post: http://webreflection.blogspot.com/2011/11/array-extras-and-objects.html The quick version, and all I am asking is an opinion about this, is obj.forEach(function (value, key, original) { // all true conditions original.hasOwnProperty(key); value === original[key]; original === obj; this === optionalContext; }, optionalContext); Thanks for any sort of feedback. Best Regards
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

