Array extras and Objects

Andrea Giammarchi andrea.giammarchi at
Thu Dec 1 02:45:04 PST 2011

you could have showed just arguments ... you don't even need the __proto__
as Array.prototype to use forEach over ArrayLike objects but you got the
point, it's not about indexes, its' about objects.

For Dmitry, these are truly simple things to add to current status, and
even if classes will be the coolest thing ever I strongly doubt Objects as
we know will disappear.

If these will stay, then we'll need a native want to iterate regardless
what will be for classes, you know what I mean?

Thanks in both cases for your feedbacks.


On Thu, Dec 1, 2011 at 10:17 AM, gaz Heyes <gazheyes at> wrote:

> On 1 December 2011 07:47, Andrea Giammarchi <andrea.giammarchi at>wrote:
>> 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.
> You can sorta do this now but it only accepts numeric indexed properties.
> E.g.
> ({0:1,1:2,__proto__:[],length:2}).forEach(alert)
> and
> [].forEach.apply(({0:1,1:2,length:2}),[alert])
> So I agree to be able to do this with any property type would be useful
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list