Thursday, May 16, 2013

JavaScript Learning #2 - Creating a new Object



**
 *  JS has built in object simply called "Object", which you can     use as a kind of blank canvas for creating any new object.
 * example:
 * my newcar = new Object();
 * newcar.color = "red";
 *
 * /


var manager = new Object();

//Assigning variable
manager.role = "People management";

function Team () {
    console.log ("Team has been called");
}

//Assigning function
manager.team = Team;


console.log("Manager role "+ manager.role);
console.log(manager.team());



Output:
Manager role People management
Team has been called

No comments:

Post a Comment