JS: Dot Notation and Prototype Chain

By Xah Lee. Date: . Last updated: .

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).

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:

JavaScript. Object and Inheritance