Creating a new Object


var myObj = new Object(); = "Ryan";
myObj.age = 22 ;



#### - - - 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 with property-key name
and it's associated value "FIRST" (which in this case is a "string-value")

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

myObj has 2 properties seperated by a comma-,,
a property with property-key type and an associated-string-value 'fancy'
a disposition-property with property-key disposition and 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' 


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 = it's associated value

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


There is also the facility Class construct notation.

The name should then start with a Capital-letter.

  var Person = function( theName, theAge ) { = theName;
         this.age = theAge;
         this.displayInstance = function() {
           console.log("The displayInstance -output-"+
                       "\n============================" +
                     "\n\t 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
  console.log( myObj );
  //you can run this in 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.