4. Adding Properties


#1

var friends = {
bill: {
firstName: "Bill",
lastName: "Gates",
number: "287 928 87 99"
}
steve: {
firstName: "Steve",
lastName: "Jobs",
number: "872 897 87 54"
}
};

When I delete the steve part there is no error but if I don't delete it
"SyntaxError: Unexpected identifier 'steve'. Expected '}' to end a object literal." this error appears. Why is this happening? I'm using the same syntax for both.


#2

you need a semi colon at the end of each object

var friends = bill: {};
steve: {};


#3

you have to just put comma after bill{},


#4

Try putting a coma after the bill object.


#5

Thank you! I was stuck with the same error as the original poster. Thanks to your comment, I see what I did wrong and have learned a significant syntax lesson!