当读取实例的属性时,如果找不到就会到原型上查找,如果原型上也找不到就去原型的原型一直找到最顶层
Object.prototype.a = "A";
Function.prototype.b = "B";
function Fn() {}
var fn = new Fn();
console.log(fn.__proto__ == Fn.prototype); //true
//每个原型都有一个constructor属性,指向该关联的构造函数。
console.log(fn.__proto__.constructor == Fn); //true
console.log(Fn == Fn.prototype.constructor); //true
console.log(fn.prototype); //undefined
console.log(Fn.__proto__ == Function.prototype); //true
console.log(Function.prototype.__proto__ == Object.prototype); //true
console.log(fn.__proto__.__proto__ == Object.prototype); //true
console.log(Fn.prototype.__proto__ == Object.prototype); //true
console.log(Object.__proto__); //function()
console.log(Object.prototype.__proto__); //null
console.log(fn.a); // A
//因为fn.__proto__.__proto__ == Object.prototype所以fn访问不到Function.prototype
console.log(fn.b); // undefined
console.log(Fn.a); // A
console.log(Fn.b); // B
console.log(Function.__proto__ == Function.prototype); //true
console.log(Function.__proto__ == Object.__proto__); //true
console.log(Object.constructor == Function); //true