#6 We made a friend error - There is a Problem with your syntax


#1


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


It says that I have a syntax error and it says that the list is missing a closing parentheses but it doesn't seem to be needing an extra one.


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

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

add("Brandon", "Creed", (786) 777-7777), "bcchewy@gmail.com");

list();


#2

when you call the add function, the phone number should be a string, and you end the function call after phone number. remove the ) after 7777


#3

Thanks. I took of the extra ) at the end of the phone number and I put it in string for and it worked.


#4