Hierarchy of Objects in JavaScript

The key to understanding objects in JavaScript is to understand JavaScript’s relationship to HTML and HTML’s structure. One of the clearest and simplest structures in HTML is the form object. Table 7.1 shows the fundamental hierarchy of objects.

Table 7.1. Hierarchy of HTML Form
Window (object)
Document (property of window)
Form (property of document)
Element (property of form)
Element value (property of element)

In JavaScript, to reference the hierarchy, the dot (.) operator serves as a linking device for the different levels in the object hierarchy, with the highest level beginning on the left and working its way to the right. In JavaScript, a generic reference to the value of a form object would look like ...

Get JavaScript Design 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.