Need help with the adress book


#1

the exercices says: Then on the next line, call printPerson() again to print out the second item in the contacts array.
I coded this:
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];

printPerson = function(person){
console.log(person.firstName + " " + person.lastName);
}
console.log(contacts[0]);
console.log(contacts[1]);

But I am not able to do the last step which is call the function
the error code is:
Oops, try again. It looks like your function didn't log "Bob Jones" to the console. Did you remember to call your function on bob?


#2

HI this line

printPerson = function(person){
console.log(person.firstName + " " + person.lastName);
}

it's missing the var before printPerson


#3

it is still saying that I didn't print bob to the console and if I remembered to call my function on bob. What do they mean?


#4

you should call the function printPerson


#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.