JavaScript 5/8: Tossing In An Array: Incorrect Example

Hey, Codecademy, the hint picture that says:

 var friends = {
    bill: {
        firstName: "Bill",
        lastName: "Gates",
        number: "(206) 555-5555",
        address: ['One Microsoft Way','Redmond','WA','98052']
    }
};

is slightly incorrect. The second-to-last curly bracket shouldn’t be there. When I keep the curly bracket in the code, I receive a syntaxError that reads “SyntaxError: expected expression, got ‘}’.”
Remove it, the code runs fine. I am running Firefox on a new MacBook Pro, and I have seen no curly brackets in my fellow coder’s code on the Q&A forum who have posted problems they had(and none of the issues were from not having curly brackets in the place I have specified). Thanks guys, keep up the great work!

Hi why not…

var friends = { //open the object friends
    bill: { //open bill
        firstName: "Bill",
        lastName: "Gates",
        number: "(206) 555-5555",
        address: ['One Microsoft Way','Redmond','WA','98052']
    } //close bill
};// close the object friends

I ran it and it work

2 Likes

@wizmarco’s right - there are supposed to be two closing brackets, to close to opening brackets.

1 Like