Displaying People error [SOLVED]



I keep receiving an error message that states: "Oops, try again. It looks like your function didn't log "Bob Jones" to the console. Did you remember to call your function on bob?"

The results screen shows the following:
Bob 0Jones
Mary 0Johnson

I'm unsure what I'm doing wrong. I've viewed other requests for help and my code appears to match others that has passed this exercise. Can someone help?

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(person.firstName, + " " + person.lastName);


Ok, I retyped my code and it works now. I'm still curious what my original error is.


What change did you make? In my code, I made a personArray variable with Bob Jones and Mary Johnson in it and called my contacts from that but since your calling yours from your actual variable contact I was thinking maybe putting Bob Jones and Mary Johnson in the contacts might work.



console.log(person.firstName, + " " + person.lastName);

you have a comma (,) after firstName, which caused the error


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