Published
Edited
May 9, 2018
3 forks
Importers
53 stars
Insert cell
Insert cell
i = {
for (let i = 0; i < 1e6; ++i) {
yield i;
}
}
Insert cell
Insert cell
function* range(n) {
for (let i = 0; i < n; ++i) {
yield i;
}
}
Insert cell
Insert cell
{
let n = 1e6;
return range(n);
}
Insert cell
Insert cell
range(1e6)
Insert cell
Insert cell
{
let sum = 0;
for (const i of range(1e3)) {
sum += i;
}
return sum;
}
Insert cell
Insert cell
{
for (const i of range(Infinity)) {
yield Promises.tick(1000, i + 1);
}
}
Insert cell
Insert cell
[...range(1e3)]
Insert cell
Insert cell
new Float32Array(range(1e3))
Insert cell
new Set(range(1e3))
Insert cell
Insert cell
function* oscillator(period) {
while (true) {
yield Math.sin(Date.now() / period);
}
}
Insert cell
Insert cell
{
for (const t of oscillator(1000)) {
yield html`<svg viewBox="0 0 12 12" width=128 height=128>
<circle stroke=black stroke-width=${1.5 + t} fill=none cx=6 cy=6 r=${3.5 + t}></circle>
</svg>`;
}
}
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