Array iterator questions

Jason Orendorff jason.orendorff at gmail.com
Sat Dec 1 08:14:31 PST 2012


1. The current draft spec has Array.prototype.@@iterator() behaving like
.values(), so:

    for (x of ["a"])
        print(x);

would print the pair ["0", "a"].

The proposal had Array iterators producing values only by default. Why the
change?

(It seems like it could be a typo, or it could be motivated by a desire for
consistency across all collections. If the latter, Map should change, not
Array.)

2. According to 15.4.6.2.2, the iterators produced by Array.prototype.keys
and .items will expose the index values as strings. Why strings? Don't
numbers make more sense?

-j
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20121201/97bbcff2/attachment.html>


More information about the es-discuss mailing list