Public
Edited
Jun 13, 2024
Insert cell
Insert cell
Insert cell
function* infiniteCount() {
let i = 0;
while (true) {
console.log("count iteration", i);
yield(i++);
if (i > 1e6) throw new Error("Avoiding an infinite loop");
}
}
Insert cell
Insert cell
{
let [a1, a2, a3, a4] = infiniteCount();
return [a1, a2, a3, a4];
}
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more