6. I'm not sure what I'm doing wrong


#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 contactsSearch = contacts.length;
for (var i = 0; i < contactsSearch; i += 1) {
if(lastName === lastName) {
printPerson(contacts[i]);
}
}
}
search("Jones");

var add = function(firstName, lastName, phoneNumber, email) {
contacts[contacts.length] = {
firstName: firstName,
lastName: lastName,
phoneNumber: phoneNumber,
email: email
}

}
add ("Percy", "Black", "(321) 3219-129", "State@example.com");

Error Message: Oops, try again. It looks like you didn't log "Percy Black" to the console. Did you remember to call list() after adding your new contact?

Would love to get some help one this. To point out what I'm doing wrong.


#2

Hi , the error says

Error Message: Oops, try again. It looks like you didn't log "Percy Black" to the console.

you should wrote inside your add function "Percy Black" instead of "Percy", "Black",

Did you remember to call list() after adding your new contact?
just read what they aske you to do.