Notebooks 2.0 is here.

Public
Edited
Feb 9
Insert cell
Insert cell
Insert cell
{
function Person(name) {
this.name = name;
}

class PersonCopy {
constructor(name) {
this.name = name;
}

sayName(){
return this.name
}
}

const person = new PersonCopy("bob");

return [
person, typeof PersonCopy
]
}
Insert cell
// 每个实例都有一个副本
{
function Person(name) {
this.name = name;
this.greet = function () {
console.log(`Hello, my name is ${this.name}`);
};
}

const p1 = new Person("Alice");
const p2 = new Person("Bob");

return [p1, p2];
}
Insert cell
{
function Person(name) {
this.name = name;
}

return [Object.getOwnPropertyDescriptors(Person.prototype)];
}
Insert cell
{
function person(name) {
return "My name is " + name;
}

return [
Object.getOwnPropertyDescriptors(person)
]
}
Insert cell
{
function Person1(name) {
this.name = name;
}

class Person2 {
constructor(name) {
this.name;
}
}
}
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