function* fn() {
let [x, y] = [0, 1];
while (true) {
yield y;
[x, y] = [y, x + y];
}
}
for(let i of fn()) {
if (i > 1000) break;
console.log(i);
}