JavaScript Complex Objects

In JavaScript objects are almost everything, and also called properties. They are variables which contain many values, which is the key value pairs. e.g {name:”Cindy”}.

Object Methods

Methods are actions performed on objects.

Object properties can be both primitive values,function and other obejects.

An object method is an obeject property containing a function definition.

Object literal

You can create objects using obeject literals. When using literal, you define and create an object in a statement.

An object literal is a list inside curly braces {}.

Using standard way to create many objects of one type is to use an obeject constructor function.

this keyword

this is the object that “owns” the JavaScript code

The value of this is the object that “owns” the function, when used in a function.

The value of this is the oject itself. When used in an object.

this keyword in an object constructor does not have a value. It is only a substitute for the new object.

the value of this will because the new object when the contructor is used to create an object.