class C { *[Symbol.iterator]() { for (let i = 0; i < 3; i++) yield i; } } const c = new C(); for (const item of c) { console.log(item); }