2022-08-29 13:49:01 +03:00
|
|
|
//@target: ES6
|
2021-01-15 13:30:44 +03:00
|
|
|
class Foo { }
|
|
|
|
class FooIterator {
|
|
|
|
next() {
|
|
|
|
return {
|
|
|
|
value: new Foo,
|
|
|
|
done: false
|
|
|
|
};
|
|
|
|
}
|
|
|
|
[Symbol.iterator]() {
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (const v of new FooIterator) {
|
|
|
|
const v = 0; // new scope
|
|
|
|
}
|