3. Displaying People


#1

Feeling lost. I scrolled through other questions and I think my answer looks the same as others' whose code worked, but mine is still giving me an error.

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];

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

}

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

console output:
undefined Jones
undefined Johnson
undefined

error message:
It looks like your function didn't log "Bob Jones" to the console. Did you remember to call your function on bob?

Can someone tell me what I'm doing wrong?


#2

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

}

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


#3

That's what I typed. What am I missing? Is something spelled incorrectly?


#4

Ok, I found it. Uncapitalized N in firstName.
Thanks!


#5

just observation problem.