2/6 Not a clue what's wrong with this code


#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(contacts[1].phoneNumber);


#3

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

remove the double quotes in the square brackets


#4

Granted, this is a solution, but do we know why? It's one thing to know the right answer, but another to correct the error in another's thinking. We must be a little more forthcoming to fulfill that purpose.


#5

the quotes would indicate calling a string in the array, not an object—correct?


#6

The quotes make both terms string primitives with no other meaning to the program than string type values. bob and mary reference anonymous objects in memory. "bob" and "mary" reference nothing. They are just values in an array.