SyntaxError: Unexpected token ILLEGAL


#1

var friends = new Object();

var friends = {
    bill: {
        firstName: "Bill"
        lastName: "Gates
        number: "(206) 555-5555"
    }
    steve: {
        firstName: "Steve"
        lastName: "Jobs"
        number: "(206) 555-5555"
    }
};

What is wrong with this
@albionsrefuge


#2

"Gates" is missing a ".
You need a comma between each of the property: value pairs.
You need a comma between the bill and steve objects.


#3

When i do that i get SyntaxError: Unexpected identifier


#4

Show me your updated code please.


#5

var friends = new Object();

var friends = {
    bill: {
        firstName: "Bill"
        lastName: "Gates"
        number: "(206) 555-5555"
    }
    steve: {
        firstName: "Steve"
        lastName: "Jobs"
        number: "(206) 555-5555"
    }
};

#6

Before we get too far along here. you don't need to create the friends variable twice -- that is what you are doing every time you say var friends. You don't need the first line.

Now, back to the missing commas. I don't see any there yet.


#7

New Code
`var friends = new Object();

var friends = {
bill: {
firstName: "Bill",
lastName: "Gates",
number: "(206) 555-5555"
}
steve: {
firstName: "Steve",
lastName: "Jobs",
number: "(206) 555-5555"
}
};`
Now it is saying SyntaxError: Unexpected identifier


#8

That's great to see more commas :smile:

Now you just need one more between the bill and steve objects.