JS 原型與原型鏈
- 每個(gè)對(duì)象都有
__proto__
屬性骂束,但只有函數(shù)對(duì)象才有prototype
屬性 - 所有對(duì)象的
__proto__
都指向其構(gòu)造器的prototype
- 所有函數(shù)對(duì)象的
__proto__
都指向Function.prototype
- 原型對(duì)象(
Person.prototype
)是 構(gòu)造函數(shù)(Person)的一個(gè)實(shí)例。(Person.prototype.constructor == Person
匿乃,person.constructor == Person
) person.__proto__ === Person.prototype
-
Person.prototype
是一個(gè)普通對(duì)象(即:Person.prototype.__proto__ === Object.prototype
) Person.__proto__ === Function.prototype
Object.prototype.__proto__ === null
-
Function.prototype
是唯一一個(gè)typeof XXX.prototype為 “function”的prototype
詳情請(qǐng)看:http://www.reibang.com/p/dee9f8b14771
JS變量提升:
http://www.reibang.com/p/b87d620185f2
JS閉包:
http://www.reibang.com/p/08fd069f35fc