2.More People. code prints, still get error message



Oops, try again. Make sure that mary is the second object in contacts

var bob = {
    firstName: "Bob",
    lastName: "Jones",
    phoneNumber: "(650) 777-7777",
    email: "bob.jones@example.com"
var mary = {
    firstName: "Mary",
    lastName: "Johnson",
    phoneNumber: "(650) 888 - 8888",
    email: "mary.johnson@example.com"
var contacts = new Array();
    contacts[0] = "bob"
    contacts[1] = "mary"


Your contacts array stores only two names - "mary" and "bob". Names, nothing more. This contacts list would be pretty useless, don't you think? It would be nice to be able to retrieve e-mail address or a phone number.

In this exercise, you were supposed to create array of objects, not array of strings.

We can't do something like this:


because "mary" is just a string, but we can do:


In the contacts array you should store objects - mary and bob.


Thank you, I see now and have passed!


You're very welcome :slight_smile:


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.