Array extras and Objects

gaz Heyes gazheyes at gmail.com
Thu Dec 1 01:17:44 PST 2011


On 1 December 2011 07:47, Andrea Giammarchi <andrea.giammarchi at gmail.com>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: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20111201/b64b9abd/attachment.html>


More information about the es-discuss mailing list