NOTE: javascript prototype chain

=== copy from mastering dojo ===

What Is a Prototype?
Every object in JavaScript contains a reference to another
object termed its prototype. Since the prototype is another
object itself, it also contains a reference to its prototype. This
forms a chain of objects. The chain terminates with the prototype
for the built-in Object type.
When a property of an object is read, JavaScript looks for the
property in the object. If not found, JavaScript then looks in the
prototype object, the prototype of the prototype, and so on,
up the prototype chain until the property is found or the chain
is exhausted. Since a method is just a property that happens to
be a function, this is how method dispatching occurs, and this
system is called prototypal inheritance.

 

=== test ===

發佈了23 篇原創文章 · 獲贊 4 · 訪問量 2萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章