2. More People


#1

I have completed the instructions in exercise 2, but keep getting the error "Oops, try again. Make sure that mary is the second object in contacts". Mary's phone number is coming up, and she is the second object in contacts. I don't understand what I've done wrong.

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 = ["bob", "mary"];
    
console.log(mary.phoneNumber);

Edit: I figured it out. I just removed the quotation marks from around bob and mary: var contacts = [bob, mary];


#2

Hi this line

var contacts = ["bob", "mary"];

you should remove the " " around bob and mary because it's make them String.... And you want to use the object nems


#3

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