3. Adding your friends


SyntaxError: Unexpected token {

I don't get how this is an unexpected token.

var friends = new Object() {
    friends.bill: 'bill';
    friends.steve: 'steve';


you are combining the object literal notation and object constructor

if you use the constructor notation:

var friends = new Object();

you don't need curly brackets ({}), you can just add property's later:

var friends = new Object();
friends.property = "some value"

when you want to use the literal notation:

var objectName = {
  property1: "value1",
  property2: "value2"

then you need the {}, don't mix the two methods


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