An array destructing specification choice

Allen Wirfs-Brock allen at
Sat Nov 5 09:54:19 PDT 2011

On Nov 5, 2011, at 9:45 AM, Dmitry Soshnikov wrote:

> On 05.11.2011 20:38, Allen Wirfs-Brock wrote:
>> In a similar vain, what is the value of r in:
>> let [z,y,...r] = {0:0, 1:1, 2:2, length: 3, 3:3,4:4};
>> should it be [2] or [2,3,4]  (and if the latter how is that determined)?
>> It seems to me that [2] is the right answer,
> How so? If `...n` is the range slice operator, it should be [2, 3, 4], no?

How do you define the range of "array-like elements" of an object.  In all other places of the ES specification, the value of the "length" property is used to determine the upper bound of the elements and any "integer keyed" elements beyond the length are ignored by array operations and functions. 


More information about the es-discuss mailing list