Building an Address Book 2/6: What am I doing wrong?!


#1


Hey, fellow coders. I'm in a bit of a jam I can't get out of. Here's a link to the said lesson:

https://www.codecademy.com/courses/building-an-address-book/0/2?curriculum_id=506324b3a7dffd00020bf661#

So here's the issue. Whenever I submit anything more than the two people objects, I get an error saying: Oops, try again. Make sure that mary is the second object in contacts! Uh, she is, isn't she? I tried the forums, reloading my browser, all that stuff. Is there something wrong with my code? Here it is:

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);

Thanks in advance!


#2

var contacts = ["bob","Mary"];// wrong
var contacts = [bob,Mary];//right

because bob and mary both are object not string :slight_smile: