Public
Edited
Dec 6, 2022
Insert cell
Insert cell
function square(n) {
return n * n;
}
Insert cell
test(() => assert.equal(square(4), 16))
Insert cell
test(() => {
assert.equal(square(4), 20);
})
Insert cell
test(() => {
assert.equal(square(4), 20);
assert.equal(square(4), 25);
})
Insert cell
Insert cell
function test(fn) {
try {
fn();
} catch (error) {
if (error instanceof assert.Assertion) {
error.message = error.message + `\n` + error.details;
}
throw error;
}

return true;
}
Insert cell
assert = import("https://esm.sh/uvu/assert")
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