Next page | Contents page |

Object properties as arrays - important!

You can also access object properties as if they were in an array. rectangle.width can be referred to as rectangle ["width"], ie by using a String version of the property name. This provides a very powerful associative array capability.

(Like hashes in Perl - in fact this trickery would be implemented as a hash table behind the scenes, for those who know about hash tables.)

We will see examples of this when we look at the Document Object Model, in a later section of the course.

Next page | Contents page |