Need help with 3. Displaying People


It's only printing Mary to the console. Not sure why?
Error message: It looks like your function didn't log "Bob Jones" to the console. Did you remember to call your function on bob?

var bob = {
    firstName: "Bob",
    lastName: "Jones",
    phoneNumber: "(650) 777-7777",
    email: ""

var mary = {
    firstName: "Mary",
    lastName: "Johnson",
    phoneNumber: "(650) 888-8888",
    email: ""

var contacts = [bob, mary];

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



i have the exact same problem! same code, everything.

what's wrong..?


must be:

var printPerson = function(person) {


The way you set up your function is wrong. You define your function with two different names: myFunction and printPerson. Where does function name myFunction come from? The code should of been like below with function printPerson:

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

// then you can call your function:


hope it helps :slight_smile:


thanks that fixed it!!!


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