"Unexpected token )"!



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]);

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.


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

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


Thanks so much! It worked!


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