Published
Edited
Aug 10, 2020
4 stars
Insert cell
Insert cell
cycle = async function*(arr) {
let i = 0;
while (true) {
yield arr[i++ % arr.length];
await Promises.delay(1000);
}
}
Insert cell
Insert cell
cycle([1, 2, 3])
Insert cell
Insert cell
md`_My number is ${cycle([1, 2, 3])}_`
Insert cell
Insert cell
{
for await (const i of cycle([1, 2, 3])) {
yield md`_My number is ${i}_`;
}
}
Insert cell
Insert cell
i = cycle([1, 2, 3])
Insert cell
md`_My number is ${i}_`
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