3. Displaying People printing correctly but won't let me proceed


#1

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

My function seems to be printing in the console correctly, but I can't proceed. I am getting the error message "Oops, try again. Did you create a function called printPerson?". I'm not sure if I'm not matching some syntax/spelling they are looking for or if I accidentally got the console to print but didn't correctly do the exercise.


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

your function calls should contain bob or mary as arguments:

printPerson(bob);
printPerson(mary);

so you should modify your function to handle this


#3

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