Confused shouldn't this work 6 We Made a Friend


#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,add];

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]);
}
}
}
function add(newfirstName, newlastName,newemail,newphoneNumber){
this.newfirstName = newfirstName;
this.newlastName = newlastName;
this.newemail = newemail;
this.newphoneNumber = newphoneNumber;

}
add("Isis", "Curiel", "curielisis16@gmail.com","2196716463" )
list()
It doesn't understand the add function


#2

Is that really what it says?
I get this:
It looks like you didn't add an person object to the end of your contacts array.
And that's not saying what you say it says! Read it again!

It really should say "a" rather than "an" but.. that's not the problem here I suppose