Help needed with error


#1

https://www.codecademy.com/en/courses/building-an-address-book/0/6?curriculum_id=506324b3a7dffd00020bf661#

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

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)
{
for(j=0;j< contacts.length;j++)
{
if(contacts[j].lastName === lastName)
{
printPerson(contacts[j]);
}
}

};

search("Jones");

var add = function(firstName,lastName,email,phoneNumber)
{
var harish = {
firstName : firstName,
lastName : lastName,
email : email,
phoneNumber : phoneNumber
};
};

add("Harish","Guntaka","harish.g33@gmail.com","937-929-9432");


Replace this line with your code. 
it is showing error as "did you create add function?"


#2

you forgot to add your new contacts person to the contacts array


#3

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