"more people" getting an error saying make sure mary is your second object


#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.phoneNumber,mary.phoneNumber]

console.log(contacts[1])


#2

@tafhim473,
Try using

contacts = [bob,mary];
console.log( contacts[1] );

#3

thanx for your reply
if i do that shouldn't it print out all the info about mary


#4

@tafhim473,
If you did not get the proper output...
maybe...
++++ reset of session *****************
As you are manipulating with objects
under certain circumstances you can shoot your Browser in an
inconsistent state.

Therefor it is of an advantage to know that you have 2 reset facilities:

One is the use of the F5-key which does a refresh Browser

and

Two, select&copy your code
Then use the Reset Code button of the course-window,
then paste your code back in.

Addendum
General Notes:
Always refresh the browser after making corrections:
CTRL f5 ( if on Windows or Linux)
CMD r ( if on a MAC).
CTRL 0 to reset browser zoom


#5

All you have to do is

var contacts =[bob,mary]

console.log(mary.phoneNumber)


#6

@theiacoding,
To get at mary's Phone-number:

 var contacts =[bob,mary]
 console.log( contacts[1].phoneNumber );

#7

That doesn't even work.


#8

@cloudace17277

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

#9

This solution does work. I had this but it wasn't working because I accidentally put var contacts =["bob","mary"] when it should be var contacts =[bob,mary]

Thanks @leonhard.wettengmx.n