I keep getting Did you remember to print out mary's phone number? Can'y figure out why


#1

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 = [];
contacts[0] = bob;
contacts[1] = mary;

console.log(contacts[1].phoneNumber);


#2

Passes on my end, I would guess that you've done something funny or ran some other code. Does refreshing the page do anything for you?

Other comments:

I'd write that as mary.phoneNumber, or if I only had access to the list I would search through it and print the number of the person with the first name of 'Mary'.
Won't make any difference, just my preference of how to interpret the instructions / code style.

Also, your contact list would be more conveniently written as:

var contacts = [bob, mary];

I can see why from the instructions why you wrote it the way you did though.


#3

Tried lots of different ways with no success! refreshed the page and it worked :confused:


#4

Was the number printed?

Perhaps you did this:

console.log = 5;
console.log('blah');  // error, 5 is not a function