1. Prototype
  2. Accessing Object Properties

Prototype

All objects created from object literals are linked to Object.prototype.

Accessing Object Properties

When you try to access a property that does not exist inside an object, javascript gives undefined.

myobject.dne
// undefined

If you try to access a property inside undefined, you get a type exception

myobject.dne.reallydne
// throws "TypeError"

To guard against this, use &&

myobject.dne && myobject.dne.reallydne
// undefined