4.Listing Everybody... Unexpected token


4.Listing Everybody

I've read over this a few times and I can't find where there is the unexpected token.
Error message: Unexpected token )

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 - 1 , i++)


for( i= 0, i < contactsLength - 1 , i++)

use ; instead of ,

and here

list; //wrong

call the function like



Wow ima fool ... Thanks a lot man !!!


you are not fool :slight_smile:

mistake is good . because you'll learn from your mistake :slight_smile:


I find the names are displayed twice, may I ask why?


The lesson checker (SCT, Submission Correctness Test) runs our code in order to test it, so we see the output twice.generally you can ignore it.

you can print at the end
console.log("my code is end")

after this any code you see in the console just ignore it :slight_smile:


Thanks, I thought it was because of my code.


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