Reworked entire script, to closer match the given examples, now "unexpected token '}' "


#1

Continuing the discussion from Prints out one key, but not the others:



https://www.codecademy.com/en/courses/javascript-beginner-en-3bmfN/0/4?curriculum_id=506324b3a7dffd00020bf661#


syntax error: unexpected token '}'
and i'm not sure why, the code i've written matches the given examples nearly perfectly (with the exception of my own entries into the Object)


var friends = new Object();

var friends = {
    matthew: {
        firstName: "Matthew",
        lastName: "Holzer",
        number: "(111) 111-1111",
        address:
    }
    callan: {
        firstName: "Callan",
        lastName: "Lattimer",
        number: "(222) 222-2222",
        address:
    }
    bill: {
        firstName: "Bill",
        lastName: "Gates",
        number: "(333) 333-3333",
        address:
    }
    steve: {
        firstName: "Steve",
        lastName: "Jobs",
        number: "(444) 444-4444",
        address:
    }
};


#2

you can't just leave address: blank, it needs a value


#3

i thought the fact that address was there was causing the issue, so i removed it, now it looks like this:

var friends = new Object();

var friends = {
    matthew: {
        firstName: "Matthew",
        lastName: "Holzer",
        number: "(111) 111-1111"
    }
    callan: {
        firstName: "Callan",
        lastName: "Lattimer",
        number: "(222) 222-2222"
    }
    bill: {
        firstName: "Bill",
        lastName: "Gates",
        number: "(333) 333-3333"
    }
    steve: {
        firstName: "Steve",
        lastName: "Jobs",
        number: "(444) 444-4444"
    }
};

and the error message is: "SyntaxError: Unexpected identifier 'callan'. Expected '}' to end a object literal."
i apologize if i'm just being dense,


#4

you need to separate the different objects with a comma (,):

bill: {
        firstName: "Bill",
        lastName: "Gates",
        number: "(333) 333-3333"
    } /* add comma here */
    steve: {

see comment, this obviously goes for all, but that should go without saying


#5

and it would go without saying for pretty much anyone else, but i'm more than a little bit dense :stuck_out_tongue:
thx for the help, i'll probably have even more questions tomorrow, xD