More people (I don't understand, please help!)


#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 = [bob, mary];

console.log("Mary's phone number is " + contacts[1].phoneNumber);

It write: "Oops, try again. Did you remember to print out mary's phone number?", but in console write: "Mary's phone number is (650) 888-8888". What's wrong?


#2

hi niss,

i am learning python and i usually see this error in codeacademy when we do not print as per instruction given in "Instruction set " .

Try to print mary's phone number as per the instruction set given in question and i am quite sure that will work

hope this helps :wink:


#3

Hi, diwakar_sharma08,

I'm sorry, my english is not goot. At instruction write: "Write a console.log statement that prints out Mary's phone number." . What question do you mean?

I try write
console.log(contacts[1].phoneNumber);
but it don't work too.


#4

can you please put a screenshot of your problem with instruction set. I'll see what i can do

your code looks ok to me

also please try this once again :slightly_smiling:

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

Try refreshing the browser with
CTRL f5 or f5 to refresh if on Windows
or
CMD r if on a Mac.


#5


I try to refresh and try to write

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

I can't understand why does it not work.
And thank you for helping :slightly_smiling:


#6

try this code let me know if it works

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


#7

It write the same mistake.


#8


#9

made the same mistake - its because I added Bob and Mary as strings to the Array - but they aren't strings, they are objects.


#10

You need to define the contacts array right before the console.log(contacts[1].phoneNumber) like this: