function* g() { yield 1; yield 2; return 3; } const it = g(); console.log(it.next().value, it.next().value, it.next().value, it.next().value);