Why is it not good?


#1


i am at ex 3


this is my error :Oops, try again. Did you create a function called printPerson?
but in the console it displays the two name:
Bob Jones
Mary Johnson

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

You just need to use person.firstName and person.lastName in the function.
Additionally, when calling it, you need to call

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

#3

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