Published
Edited
Dec 10, 2019
Insert cell
Insert cell
viewof option = DOM.select(["none", "doc"])
Insert cell
Insert cell
window
Insert cell
function sayHi(){
return "Hello world!";
}
Insert cell
window.sayHi // run before the line below, and it is not available in window
Insert cell
{
window.sayHi = sayHi;
return window.sayHi();
}
Insert cell
Insert cell
window.innerHeight
Insert cell
Insert cell
Insert cell
Insert cell
window.document // document is included inside window
Insert cell
document
Insert cell
change_body_color_later = {
// change the background color to red
document.body.style.background = "red";

// change it back after 1 second
setTimeout(() => document.body.style.background = "", 1000);
}
Insert cell
Insert cell
Insert cell
Insert cell
location.href
Insert cell
// location.href = "https://wikipedia.org"; // if do so, the page will hang itself
Insert cell
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