"Unexpected token )"!


#1


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


In my code, I can find nothing wrong, but it says "Syntax Error: Unexpected token )". I DO already know what this means, but I cannot find the loose parenthesis


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 (i=0, i<contactsLength, i++) {
        printPerson (contacts[i]);
    };
};
list()


Just a helpful thing to anyone who tries to help, I think it should be located somewhere in the for loop of the list function.


#2

You need to replace the commas with semi-colon's like:

for (i=0; i<contactsLength; i++) {

#3

Thanks so much! It worked!


#4

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