JS: Dot Notation and Prototype Chain
Dot Notation a.b.c Does Not Show Prototype Chain
When you see a.b.c.d in JavaScript, it has very different meaning than Java or Python, Ruby. This is a major point of confusion.
In Java, in a.b.c.p, the dot means parent/child except the last dot, is object/property.
So, a is parent of b,
b is parent of c,
and c is the object that has member p.
In JavaScript, dot always means a relationship between a object and a property key name. There's no direct syntax to show parent chain.
in JavaScript, when you see a.b.c.d, the left/right thing of any dot has a object/property (own or inherited) relationship.
It's parsed like this: (((a).b).c).
- Object
ahas property keyb - Object
a.bhas property keyc - Object
a.b.chas property keyd
The value of the property, such as a.b, could be any object, having nothing to do with any of the object a or a.b or a.b.c.
For example, the expression Array.prototype.slice.call:
- The parent of
Array.prototype.slice.callisFunction.prototype. - The parent of
Array.prototype.sliceisFunction.prototype. - The parent of
Array.prototypeisObject.prototype. - The parent of
ArrayisFunction.prototype.
JavaScript. Object and Inheritance
- JS: Object Tutorial
- JS: Object Overview
- JS: Object Type
- JS: Test is Object Type 📜
- JS: Determine Type of Object
- JS: Prototype and Inheritance
- JS: Prototype Chain
- JS: Object.prototype.isPrototypeOf
- JS: Get Set Prototype
- JS: Show Prototype Chain 📜
- JS: Prototype Tree
- JS: Dot Notation and Prototype Chain
- JS: Create Object
- JS: Object Literal Expression
- JS: Object.create
- JS: Object Literal Expression vs Object.Create
- JS: Create Object with Parent X
- JS: Prevent Adding Property
- JS: Deep Copy Array or Object 📜
- JS: Test Equality of Array and Object by Content 📜
- JS: Add Method to Prototype
- JS: Object (class)
- JS: Object Constructor
- JS: Object.prototype