Lesson 3 displaying people error code says mary undefined and bob undefined


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

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


#2

Do you mean that your code prints undefined, not that an error message is saying that mary and bob are undefined?

If you're printing undefined then you'll want to look at the line that did that printing and consider which value it is trying to print


#3

var printPerson = function(person) {
console.log(person.firstName + " " + person.LastName);<---lastName " you used CAPS "L"
};


#4

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