6/6 I don't know whats wrong with my code


#1

My code is not running and I can't figure out why. When I run it, I get following error message:
"SyntaxError: missing ) after argument list"

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"*/

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(firstName, lastName, phoneNumber, email) {
contacts[contacts.length] = {
firstName: firstName,
lastName: lastName,
phoneNumber: phoneNumber,
email: email,
};
};

add("Mike", "Mueller", 6598 985-5588, "mkm@example");

list();


#2

To do this, you must cancel out the if statement in your search function, and at the end put

search("___")

The ___ must be the last name of the person you are adding.


#3

Thank you, but still doesn't work. That's the error message I get:

"SyntaxError: missing ) after argument list"


#4

You're missing the quotes around the phone number. It's looking for it to be a string


#6

Thank you so much. You solved more than a week of struggle :smile:


#7

No problem! Sometimes it just takes a fresh set of eyes