Dot-syntax is the name of an object followed by a dot (
.) and then one of the object's properties or methods (technically methods are properties). The dot connects the object with its property or method. Here's a look at dot-syntax:
When we say that the dot "connects" the object to its property, we are saying that the object queries that property name. By accessing its property you can use its value and by connecting to the object's method, you can execute it. If that property doesn't exist yet, then this expression should be creating this property. Here is an example of the
document object connecting to its
In this example above, the
document object uses its
write() method to print the string "
Hello World" to the screen.
var i = shoppingCartArrayName.length;
In this example above, the variable
i is declared and then assigned the value of the
length property of the
shoppingCartArrayName array object. This value should be equal to the number of elements in the