Why do objects log as undefined?

In the photo here, I can perform a console.log using collection[0] and display the entire object. However collection[0][0] does not display the firstName property, but undefined. Why do objects perform in this manner?

contacts[0] is the object, as you pointed out, contacts[0][0] is looking for an array in contacts[0] which of course there is not. if you want the firstName property you would need to do something like contacts[0].firstName or contacts[0]['firstName'] I believe would work as well.

1 Like