Objects—What Are They?

In their simplest terms, objects are collections of methods and properties. Remember the analogy that objects are things. Objects have properties (such as computers have monitors, cars have wheels, and so on), and methods are things that objects can do (cars can move, scissors can cut, and so on).

If you put objects, properties, and methods together, you start to get a better idea of what objects are. In JavaScript, objects and their respective properties and methods are put together by separating them with periods (.), which is called dot syntax. So, if the real world was controlled by JavaScript, you might have the following:

computers.monitors
cars.wheels
scissors.cut()

Notice how this enables you to better describe ...

Get JavaScript™ 1.5 by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.