
| 属性 | 释义 |
|---|
| constructor | 指向对象的构造函数 |
| prototype | 指向函数自身的原型对象 |
| __proto__ | 指向对象构造函数的原型对象 |
function Person(name) {
this.name = name;
}
Person.prototype.fn = function() {
console.log(this.name);
};
var person = new Person('小明');
person.constructor === Person;
person.__proto__ === Person.prototype;
Person.constructor === Function;
Person.__proto__ === Function.prototype;
Person.prototype.constructor === Person;
Person.prototype.__proto__ === Object.prototype;
Object.constructor === Function;
Object.__proto__ === Function.prototype;
Object.prototype.constructor === Object;
Object.prototype.__proto__ === null;
Function.constructor === Function;
Function.__proto__ === Function.prototype;
Function.prototype.constructor === Function;
Function.prototype.__proto__ === Object.prototype;