Javascript variables: var person = “John Doe”;
Javascript objects are variables too. But objects can contain many values.The values are written as name : value pairs.
eg. var person = {firstName:”John”, lastName:”Doe”, age:50, eyeColor:”blue”};
Object properties can be both primitive values, other objects, and functions.
Creating new objects:
1) Using an Object Literal
2) Using the JavaScript Keyword new
3) Using an object constructor
Javascript Properties:
1) person.age
2) person[“age”]
3) x = “age”; person[x]
Delete properties: delete person.age
Javascript Object Prototypes:
Every JavaScript object has a prototype. The prototype is also an object.
All JavaScript objects inherit their properties and methods from their prototype.
eg. Person.prototype.nationality = “English”;
eg. Person.prototype.name = function() {
return this.firstName + ” ” + this.lastName;
};
Links to reference post : http://www.w3schools.com/js/js_object_definition.asp