3. Displaying people - I don't see why this won't work


<3. Displaying people> https://www.codecademy.com/courses/building-an-address-book/0/3?curriculum_id=506324b3a7dffd00020bf661

My initial answer gets an error message "Oops, try again. Did you create a function called printPerson?".

This is the initial answer:

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

This is the correct answer:

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

Both gets the same result printed. I assume the difference between the two is how you define the parameter person . Is my initial answer incorrect, or is it just because only the second answer is programmed to be correct?


Both are correct, but the exercise seems to be programmed to only approve the second one.


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