SyntaxError: missing ) after argument list


#1

An extra set of eyes would be wonderful

I keep getting the error in the title, but I can't find the issue

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"*/
function search(personName){
var contactsLength = contacts.length;
for(var i = 0; i < contactsLength; i++){
if(contacts[i].lastName === personName){
printPerson(contacts[i]);
}
}
}

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

add("kevin", "raskell", "123@gmail.com" "123456789");
list();


#2

Hi kevorski,

It appears you have a missing comma in your second-to-last line. Look carefully at your list of arguments when you call the add function :wink:

Without the comma, the interpreter believes the list of arguments has ended, hence why it's expecting an ")".

Also, please don't forget to format your code when you paste it in the Q&A forums. Formatted code is much easier to read! :slightly_smiling:


#3

Hi this part

add("kevin", "raskell", "123@gmail.com" "123456789")

You missing the , between "123@gmail.com" and "123456789"