More People 2/6


#1

Hello!!!!
So i have a problem with my code. When i try to pass it says:

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

And here is my code:

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("(650) 888 - 8888")

I don't see the problem since Mary is the second object in contacts
Thanks in advance to anyone that can help.


#2

@seljanz

Debugging errors.......

[Error]No quotes between bob and mary because they are objects, not string!

Additional issue...

[Error]To get access to a property value inside an object, we do it like this:

console.log(mary['phoneNumber']);

#3

OMG!!!
Thank you i've been stuck on that for some time now!


#4

I think this is how it should actually be.

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(contacts[1].phoneNumber);