Displaying people


#1

Can anyone help with my code. I have a "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?" and really don't know why;

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 added here

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

printPerson(contacts[0]);
printPerson(contacts[1]);


#2

Remember to add a semicolon after defining your printPerson function


#3

thanks but I added it and i still have the same message


#4

this text appears in the console : undefined Jones
undefined Johnson
undefined


#5

In your printPerson function change "" by " ". I mean use a space between the firstname and lastname


#6

thx. I am sorry I still don't ubderstand: i already left a space btw the firstname and lastname . I even added a new space but i still get the same message. Don't really understand because my code is the same as the others on the forum


#7

I got it: it was the capital N of lastName ( i made the error of writing a lowercase). Thx a lot for trying to help


#8

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