`const [a, b] = Array.from(anyArraylikeObject);`
On Tue, Mar 19, 2019 at 7:22 PM Frederick Stark <coagmano at gmail.com> wrote:
> This already works with an iterator, because array destructuring uses the
> iterator protocol
>
> const [a, b] = {
> 0: "ayy",
> 1: "bee",
> length: 2,
> *[Symbol.iterator]() {
> let i = 0;
> while (i < this.length) {
> yield this[i]
> i++
> }
> },
> };
>
>
>
> On Mar 20 2019, at 11:59 am, Sultan <thysultan at gmail.com> wrote:
>
> Afford array destructuring to Array-like objects.
>
> const [a, b] = {0: a, 1: b, length: 2}
>
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
> _______________________________________________
> 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/20190319/35560058/attachment.html>
forbes at lindesay.co.uk (2019-04-24T11:21:48.962Z)