|
October 7, 1999 Object Types Tips: October 1999
Yehuda Shiran, Ph.D.
|
|
JavaScript supports two different types of objects. Built-in objects, such as Math, that you cannot modify. PI, for example, is a property of the Math object and obviously cannot be modified. User-defined objects are created by the author. The course object discussed on October 6, 1999, is a user-defined object.
An object can be a property of another object, thus creating an object hierarchy. Suppose an object
A property belongs to an object, and only to one object. A variable may be named exactly like a property of an object. The following statement is valid:
However, a variable cannot have the same name as an object at the same level (scope). The following statement is not valid:
It's good practice to avoid repeating names.
People who read this tip also read these tips: Look for similar tips by subject: |