In JavaScript, most things are objects. You can use objects as containers to encapsulate related functions and variables into efficient packages. To create objects in JavaScript, add properties and assign values, you can either use an object constructor:

See the Pen thecodelog.com - JS Objects 1 by Deano (@deangilewicz) on CodePen.

Or you can use an object literal:

See the Pen thecodelog.com - JS Objects 2 by Deano (@deangilewicz) on CodePen.

Accessing property values on an object can be done in one of two ways:

See the Pen thecodelog.com - JS Objects 3 by Deano (@deangilewicz) on CodePen.

There is no ReferenceError thrown if you try to access an object property on a global object.

See the Pen thecodelog.com - JS Objects 4 by Deano (@deangilewicz) on CodePen.