Putting the pieces together

You can put together objects, properties, and methods to get a better description of an object, or to describe a process. In JavaScript, these pieces are separated by periods (also known as dots, as in Internet addresses). This is called dot syntax. Here are some examples of objects and their properties written in this way:

bicycle.wheels

cat.paws.front.left

computer.drive.dvd

document.images.name

window.status

And here are some examples of objects and methods written in dot syntax:

cat.purr()

document.write()

forms.elements.radio.click()

Get JavaScript and Ajax for the Web: Visual QuickStart Guide, Seventh Edition 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.