Javascript Reference
Categories: Object_Obj

javascript Object_Obj Description

@March 15, 2008, 1:22 a.m.
ObjectFirefox/Netscape/NN 3 IE 4 ECMA 1  

  

In addition to serving quietly as the foundation of all native JavaScript objects, the Object object is the pure model of the JavaScript object including custom scripts objects you create. Use the Object object to generate things in your scripts with behaviors that are defined by custom properties and/or methods. Most typically, you start by creating a blank object with the constructor function and then assign values to new properties of that object.

 

Navigator 4 and later and IE 5 and later also let you assign properties and values via a special literal syntax that also creates the Object instance in the process:

var myObject = {propName1:propValue1[, propName2:propValue2[, 
...propNameN:propValueN]]}
 

You can use objects as data structures for structured custom data in your scripts, much like creating an array with named index values.

 
Properties
 
constructor prototype
 
Methods
 
hasOwnProperty( )isPrototypeOf( )propertyIsEnumerable( )
toLocaleString( )toString( )valueOf( )
 
Creating an Object Object
 
var myObject = new Object( );
var myObject = {propName1:propVal1[, propName2:propVal2[,...N]]};
var myObject = new constructorFuncName([propVal1[, propVal2[,...N]]]);

Powered by Linode.