`const [a, b] = Array.from(anyArraylikeObject);`
On Tue, Mar 19, 2019 at 7:22 PM Frederick Stark <[email protected]> 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 <[email protected]> wrote:
>
> Afford array destructuring to Array-like objects.
>
> const [a, b] = {0: a, 1: b, length: 2}
>
>
> _______________________________________________
> es-discuss mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/es-discuss
>
> _______________________________________________
> es-discuss mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/es-discuss
>
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss