Array iterator questions

Rick Waldron waldron.rick at
Sun Dec 2 12:39:36 PST 2012

On Sun, Dec 2, 2012 at 2:47 PM, Allen Wirfs-Brock <allen at>wrote:

> On Dec 1, 2012, at 8:14 AM, Jason Orendorff wrote:

> snip

> > 2. According to, the iterators produced by
> Array.prototype.keys and .items will expose the index values as strings.
> Why strings? Don't numbers make more sense?
> >
> It does that because array index keys are exposed as strings everywhere
> else.
> There is no specific definition (that I can find) of the keys iterator for
> arrays in the wiki proposal.  There is only the general @iter.keys function
> which is defined in terms of for-in and hence returns string property keys.
> However, I don't have any objection to return integer keys in this case.


Users will take this for granted and assume the index value is going to be
a number since map, forEach, filter, every, some and reduce all pass a
number as the index argument and for-loops increment a number.


> Allen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list