Public
Edited
Feb 5
Insert cell
Insert cell
Insert cell
Insert cell
{
const obj = Object();

return [obj.prototype, obj.__proto__];
}
Insert cell
Insert cell
{
class myObj {
constructor() {
this.name = "li";
}

age = 10;
}

const obj = new myObj();

return [
obj,
obj.prototype,
obj.__proto__,
myObj.prototype,
myObj.prototype.age
];
}
Insert cell
{
const obj = Object();

try {
obj.a.b = "li";
} catch (error) {
return error.toString();
}

return obj;
}
Insert cell
{
function parent() {
this.name = "l1";
}

parent.prototype.age = 10;

return parent.prototype
}
Insert cell
{
function Parent() {
this.name = "li";
}

const parent = new Parent();

}
Insert cell
Insert cell
{
const obj = Object();
const fun = function () {};

const newFun = new fun();

return [obj.prototype, fun.prototype, obj.__proto__, fun.__proto__, newFun];
}
Insert cell
// 一个空的构造函数拥有的属性
{
function Person() {
console.log("hello world");
}

return Object.getOwnPropertyDescriptors(Person);
}
Insert cell
{
function Person() {}

return Object.getOwnPropertyDescriptors(Person.prototype)
}
Insert cell
// 和链表的思路一样,是一个循环链表
{
function Person() {}

return [
Person.prototype.constructor ===
Person.prototype.constructor.prototype.constructor,
Person.prototype.constructor === Person
];
}
Insert cell

{
function Person() {
console.log("hello world");
}

return Person.toString()
}
Insert cell
{
const obj = () => {};

return obj.toString.toString();
}
Insert cell
{
// function person() {}

const Person = {
name: "Person",
length: 0
};
Person.porperty = {
constructor: Person // 自身的引用
};

return Person;
}
Insert cell
{
const person = {};

return [person.__proto__.constructor === person.constructor, // constructor 是在原型链上找到的
person.constructor]
}
Insert cell
{
const person = Object();

return [person.__proto__ === Object.prototype, person.__proto__, Object.getOwnPropertyDescriptors(person.__proto__)]
}
Insert cell
{
return Object.getOwnPropertyDescriptors(Object)
}
Insert cell
{
return Object.getOwnPropertyDescriptors(Object.prototype)
}
Insert cell
{
function fn() {
return "hello world";
}

const func = new fn();

return func;
}
Insert cell
{
const fun = function () {
constructor: {
const arr = Array();
arr.push(10);

return arr;
}

return "hello world";
};

const func = new fun();

return [func, fun()];
}
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