Array extras functionality for iterators

Rick Waldron waldron.rick at gmail.com
Tue Feb 28 09:21:57 PST 2012


On Tue, Feb 28, 2012 at 12:06 PM, Yehuda Katz <wycats at gmail.com> wrote:

> Catching up on this discussion.
>
> Personally, I'd like to see us come to quick consensus on `forEach` for
> collections, because without something like `forEach`, it's impossible to
> implement useful versions of these collections in user-space in browsers
> that do not implement for-of.
>
> Indeed, the current browsers that implement Map and Set do not implement
> for-of, which means that even though browsers implement the collections
> (and Mozilla has for a bit now), they are not very useful because they
> cannot be iterated over. Had `forEach` been part of the initial spec, I
> would be using them today.
>

I've had the same experience that Yehuda describes - it's almost comical
that Chrome blog published an announcement for the support of Map and Set,
beyond...

> var s = new Set()
"undefined"
> s.add("foo")
"undefined"
> s.has("foo")
true
> s.delete("foo")
"undefined"

...They are useless.



>
> One last thing: `forEach` on `Map` should probably pass the key and value
> to the function.
>

+1 to Map.prototype.forEach receiving key and value as arguments


>
> Yehuda Katz
> (ph) 718.877.1325
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120228/35bd2c90/attachment-0001.html>


More information about the es-discuss mailing list