4. Listing Everybody



Syntax Error: Invalid or unexpected token. This is my code I also copy and pasted code from a previous thread that said it worked for them in May. Any clues?

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

var list = function(){
    var contactsLength = contacts.length;
    for(i=0; i<contactslength; i++){


HI this line

for(i=0; i<contactslength; i++)

you wrote contactslength instead of contactsLength


Good eye! Still the same error unfortunately...


Did you change another thing in your code because the one post when I made the change it works

CAn you post your new code


ok, haha, now it works. I don't know what I was doing, many thank yous for your help!


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