The Concept
Whoa! Let's pause and review. We know that JavaScript has objects, which are like nouns or things. We know that objects have properties that describe how
objects look, just as adjectives describe nouns. We refer to properties as object.property.
We also know that objects have methods, or actions that can be performed to the object. All methods have (parentheses) and are referred to as object.method(). Different objects have access to different properties and methods.
Now we'll learn the secret to understanding JavaScript, the hierarchy of Objects.
DON'T TELL A SOUL, but once you understand this, you've conquered JavaScript!
What We Mean
The Hierarchy of Objects Effect
All references begin with the top object, the Window (the browser screen), and go down. Windows and frames both belong to the Window object. You do not need to reference these unless there is more than one! Top, self,
parent, and frames are built-in names for windows. Don't worry too much about these. Just know they exist.
Here are some examples. Notice they follow the hierarchy above, from top to bottom.