5/8, SyntaxError: missing } after property list


#1

What is the problem here?

var friends = {

bill: {
    firstName: "Bill",
    lastName: "Gates",
    number: "503-555-5555",
    address: ['Detroit', 'MI']

    } 
steve: {
    firstName: "Steve",
    lastName: "Jobs",
    number: "666-966-6666",
    address: ['Palo alto', 'CA']

    }

};


#2

@kderrick1988,
You are forgetting a comma-separator-,
between the bill and steve properties of the friends object

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

================================

=== the Objects explained ===

- - - B a s i c s - - -

Each Object has one or more properties.
Each property consists of a property-key and it's associated value.

 var object1 = {
              name: "First"
              }

So object1 has 1 property
a name property with property-key name and it's associated string VALUE "FIRST"

OR

var myObj = {
         type: 'fancy',
         disposition: 'sunny'
        }

myObj has 2 properties seperated by a comma-,,
a type property with property-key type and an associated string VALUE 'fancy'
a disposition-property with property-key disposition and
..an associated string VALUE 'sunny'.

= = = = = = = = = = = = = = = = = = = = = = =

To create an Object,

you can use the literal notation,

you directly create an Instance of the object, with the
properties being separated by a comma-,

  var myObj = {
        type: 'fancy',
        disposition: 'sunny' 
  };

OR

You create an Object by the construct notation.

First you create an empty Object by way of either
myObj = new Object(); or myObj = {};
and then you attach its properties using the syntax
object-name.property-key = it's-associated-value ;
( this.name = x ; )

thus:

  var myObj = {};
      myObj.type = 'fancy';
      myObj.disposition = 'sunny';

OR

There is also the facility Class construct notation.

The name should then start with a Capital-letter.

  var Person = function( theName, theAge ) {
         this.name = theName;
         this.age = theAge;
         this.displayInstance = function() {
           console.log("The displayInstance -output-"+
                       "\n============================" +
                     "\n\t name: " + this.name +
                     "\n\t age: " + this.age);
                       };
       };
    //now create an Instance of this Class-object
  var myObj = new Person("Classy_Rocker",20);
    //call the Method displayInstance which takes NO parameters
  myObj.displayInstance();
  console.log( myObj );
  //you can run this in labs.codecademy.com try it !!

As you can see i created a function within this constructor,
they now call this function a Method.
So if in near future the course is asking you to create a method you now know
that you have to create
a property-key with an associated value being a function within an Object.