Displaying people


#1


I am at the part where you use the "printPerson" function to call the names.


Every time i hit save and submit, it asks me if i remembered to make a printPerson function, even though i clearly made one and it works. The console logs "Bob Jones" and "Mary Johnson." I think it is the system. Please help dev team and fix it. Here is the 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(contacts[person].firstName + " " +
    contacts[person].lastName);
    };
    
    printPerson(0);
    printPerson(1);.


#2

https://www.codecademy.com/forum_questions/56157a10e39efe0c720002de

i think they want us to use "this" from the prior lesson. but my code looked just like yours and makes more sense to me. the "this" throws me off.


#3

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

Try this


#4

It worked, but i don't understand why the other method is not counted...


#5

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