In JavaScript,  objects are containers for variables. Objects contain named values and can contain multiple values. This is what is known as key : value pairs. Each set of key : value pairs is separated by a comma. As with variables, the value can be a string, a number, boolean or null. String values are contained in quotation marks. Values that are numbers, boolean or null are not contained in quotation marks.

Previously in the documentation for JavaScript in books and on the ineternet, keys were referred to as properties or names when discussing objects.

Three dot cartouche

To explain this in other terms, lets use an airplane as an example.

The airplane itself is an object.

Possible keys for the airplane could be the model number, the cruising speed, the capacity, the maker, etc. Each of these keys can be assigned a value.

Three dot cartouche

Defining Object Literals

You define a JavaScript object with an object literal. Below is an example of an object literal which is a series of key : value pairs separated by commas. The object is airplaneA.

var airplaneA = {model : "747-400", cruisingspeed : "Mach 0.85", capacity : 366, maker : "Boeing"};


var airplaneA = {
    model : "747-400",
    cruisingspeed : "Mach 0.85",
    capacity : 366,
    maker : "Boeing"

Three dot cartouche

Accessing items from an object

The object in the example above is airplaneA. If you want to pull what the maker is for thi object you would use what is called dot syntax. State the object and period then the key.

var planeMaker = airplaneA.maker;