p href="#如果没有prototype就是不能修改上级原型" aria-hidden="true">如果没有prototype就是不能修改上级原型
原始Object{valueOf:function(){},toString:function(){},...} Object{proto:原始Object} new 关键字出来的对象全部都是【继承自原始Object的Object】
// Object->function(){} -> Object{} -> null
Object.__proto__ //function(){}
Object.__proto__.__proto__ //Object{}
Object.__proto__.__proto__.__proto__ //null
// 例子
function person(){}
person.__proto__ //function(){}
person.prototype // Object{} //继承自原始对象的对象
var p = new person();
p.__proto__ //Object
p.__proto__.__proto__ //Object
p.__proto__.__proto__.__proto__ //null
function child (){}
//继承自person
child.prototype = person;
var c = new child();
c.__proto__ //person
c.__proto__.__proto__ //function(){}
c.__proto__.__proto__.__proto__ //Object{}
c.__proto__.__proto__.__proto__.__proto__ //null
// o -> Object{} -> null
var o = new Object(); // o是一个继承自原始对象的对象
o.__proto__ //Object{}
o.__proto__.__proto__ //null
function Object1(){}
var o1 = new Object1();
console.log(o1.__proto__ ) //Object{} 原始对象的对象
console.log(o1.__proto__.__proto__) //Object{} 原始对象
console.log(o1.__proto__.__proto__.__proto__); //nullfunction person(){}
function animal(){}
function child(){}
child.prototype = person;
var c = new child();
c.__proto__ //person
child.prototype = animal;
var c2 = new child();
c2.__proto__ //animal由以上分析,函数是一个对象,那么闭包就是对象中的私有成员,外部无法访问,但始终存在