2023-02-23 10:55:58 +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
|
|
|
|
|
}
|