2. More people


#1

Hi guys, any ideas as to why I'm getting the error message '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 = ["bob","mary"];

console.log(mary.phoneNumber);


#2

Remove the quotes:

var contacts = [bob, mary];

#3

Thanks! :grinning: I always mess up on the finer details.


#4

@jibblyj is this cause both 'bob' and 'mary' were set as variables?


#5

Yes.   


#6

here are some error pls find out any pls
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);

error is Oops, try again. Did you remember to print out mary's phone number?


#7

why var contacts = [bob, mary]; ???

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

explain me plz.


#8

bob and mary are objects that you already defined, "bob" and "mary" are strings.