Array tail destructuring

Cyril Auburtin cyril.auburtin at gmail.com
Tue Oct 4 14:58:17 UTC 2016


Ah right, well caught :)

for arrays I forgot it's possible to do:

`var a=[1,2,3,4,5,6], {[a.length-1]: last}=a; last`

2016-10-04 15:33 GMT+02:00 Jason Orendorff <jason.orendorff at gmail.com>:

> On Tue, Oct 4, 2016 at 7:12 AM, Cyril Auburtin <cyril.auburtin at gmail.com>
> wrote:
>
>> I didn't understand everything discussed above, but to me, the only
>> asymmetry between head and tail destructuring is for infinite iterators:
>>
>> `var [x] = neverEndingIterator` vs `var [...a, x] = neverEndingIterator
>> // fails`
>>
>
> Read the post just before yours. Caitlin pointed out another difference.
>
> -j
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20161004/bffec747/attachment.html>


More information about the es-discuss mailing list