Hierarchy is just a big nerdy word for
ranking system
.
Here is an example of hierarchy in day-to-day life:
The U.S. millitary has a hierarchy of several ranks; majors have more authority than leutenents, and leutenents more authority than pleebs.
You might want to know
why
JavaScript uses hierarchy (if you've not all ready zoned out).
The answer is simple; there are three main reasons for using hierarchy:
Hierarchy makes it simple to have several variable's, all with the same name, and all with different values.
Example:
object1.object2.variableName=13;
object1.variableName="SNARF!";
variableName=3.14159625358979;
It also makes it easier to tell which property belongs to which object (we get in to properties and objects soon enough);
Lasty, Hierarchy creates a standard by which the computer programming industry can follow to make JavaScript compatable with other computer operating systems.
Properties and Objects
as promised
An object is--for lack of a better word--an object. It is basically the representation of an actual component of your web page.
Here are some examples of objects that you would use in a webpage.
window.document.write("Hello world!");
In this example we tell the computer to access the
window
your page is on, access the
document
, and
write
"Hello World!" to it.
parent.frame1.write("BEHOLD! The power of the first frame!");
Here we actually tell the computer to go to
frame1
in the
parent
window and
write
"BEHOLD! The power of the first frame!".
FYI: This last example would only used in a webpage that has frames(if you don't know what a parent and child frame is go back to the HTML tutorial and do NOT collect $200).
Wrap-up
This concludes what I consider to be the most boring part of all tutorials--the dreaded logic.
Just two more chapters before you can
honestly
say you know JavaScript--Never give up, NEVER surrender!
As we progress to the ninth chapter we shall learn a bunch of different commands that will help you out once you embark on you worldly journey as a developer.