2/6 What kind of issue am I facing?


#1

Hi guys,

Here is my code - got no clue why this is not working (even the number gets printed):
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

Don't forget the ( & ) when using console.log(). (and don't put = there. Just console.log().)


#3

@mrmrks,
You are re-assigning the console.log Method with the string Value "(650) 888-8888"
You might want to use

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

but before you do that you will have to Reset your Browser

++++ reset of session *****************
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


#4

that doesnt works:console.log( contacts );
console.log( contacts[1].phoneNumber );


#5

Dudes..thats the correct 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);
};