forbes at lindesay.co.uk (2019-04-24T11:21:38.846Z)
This already works with an iterator, because array destructuring uses the iterator protocol
```js
const [a, b] = {
0: "ayy",
1: "bee",
length: 2,
*[Symbol.iterator]() {
let i = 0;
while (i < this.length) {
yield this[i]
i++
}
},
};
```
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 > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20190320/10383521/attachment.html>