function* fibonacci() {
let current = 1;
let next = 1;
while (true) {
yield current;
[current, next] = [next, current + next];
}
}
const rows = fibonacci().chunks(5);
for (const row of rows.take(5)) {
console.log(row.join("\t"));
}Iterator.prototype.chunks() / notebook
Iterator.prototype.chunks()
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.