Practice: Exploring Objects Using JavaScript
There is another way to access object properties – using bracket notation. Instead of using these:
person.age person.name.first
You can use
person['age'] person['name']['first']
This looks very similar to how you access the items in an array, and it is basically the same thing – instead of using an index number to select an item, you are using the name associated with each member's value. It is no wonder that objects are sometimes
called associative arrays – they map strings to values in the same way that arrays map numbers to values.