Displaying people


#1

Oops, try again.
Did you create a function called printPerson?

prints out bob jones and mary johnson fine tho

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

Try with other style.

function printPerson(person){
// some code...
}

#3

thnx worked

.
.

..

..
.


#4

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