Confused on 6/6, Syntaxerror for no apparent reason


#1

So I just added this code

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

search("Jones");    
add("M", "T", "Benis", "01189998819991197253");
list(contacts);

But I get a syntax error that there is an unexpected '[' I've searched through the rest of the code and cannot find an unpaired [ , is there something I'm doing wrong here?


#2

First of all, it is said in the instructions that you have to delete any other function that logs to the screen. You can find that in the last sentence. So, delete the search function. Also, the list function does not take an argument. It's been defined inside it that what is to be logged is a list of the items in the contacts array. Try these and see if they solve the problem.

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

add("M", "T", "Benis", "01189998819991197253");
list();