Whats wrong with this code?


#1

The following code returns as "undefined", while I want it to return as "(650) 888 - 8888". I cant see whats wrong with this 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 (contacts[1["phoneNumber"]])


#2

i guess this gonna work

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

#3

I hope this will be your answer..
var contacts =[bob, mary];
console.log(contacts[1].phoneNumber);


#4

YAAAAY! It works! Thanks for the help!