Displaying People: Code functions properly, but 'printPerson' does not check out?


#1

Here is my code from lines 18 onward. I define the function 'printPerson' on the first line, and it successfully prints "Bob Jones" and "Mary Johnson". However, when I submit, it rejects the code with the error message "Oops, try again. Did you create a function called printPerson?"

Could this be a bug in the code checker, or am I missing something obvious?

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

printPerson(0);
printPerson(1);


#3

// printPerson added here

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

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

This is the code what i wrote. The flow is the same as yours, but the idea is to pass an array element to the function, so this can process it and then access to its firstName and the other attribute.