Can someone please help me? this is 6. We made a friend. and this is not working out!


#1

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];

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

function list() {
var contactsLength = contacts.length;
for (var i = 0; i < contactsLength; i++) {
printPerson(contacts[i]);
}
}

/*Create a search function
then call it passing "Jones"*/
var search = function (lastName) {
var contactsLength = contacts.length;
for (var i = 0; i < contactsLength; i++) {
if (lastName == contacts[i].lastName) {
printPerson(contacts[i]);
}
}
};
search("Jones");

var add = function(firstName, lastName, email, phoneNumber) {
var chris = {
firstName: firstName,
lastName: lastName,
email: email,
phoneNumber: phoneNumber
}
};
contacts[contacts.length] = add("Chris", "Jones", "chris.jones@example.com", "(256) 222-2222");
@amanuel2


#2

I'd recommend looking at the item creation for the 'var chris' function