Object

The base class of all JavaScript objects.

Methods:

Object, hasOwnProperty, isPrototypeOf, isValid, propertyIsEnumerable, toLocaleString, toSource, toString, unwatch, valueOf, watch

Objects:

Function, Object, Reflection

Property Listing

Property

Type

Access

Description

constructor

Function

readonly

Points to the constructor function that created this object.

Note that this property is treated as an XML element in the XML class.

prototype

Object

readonly

Points to the prototype object for this object.

Note that this property is treated as an XML element in the XML class.

reflect

Reflection

readonly

Retrieves and returns the Reflection object associated with this method or a property.

Note that this property is treated as an XML element in the XML class.

Method Listing

Constructor

Object Object (what:Varies)

Creates and returns a new object of a given type.

Parameter

Type

Description

what

Varies

The object type.

Boolean hasOwnProperty (name:String)

Reports whether a given property is defined with an instance or within the prototype chain.

Parameter

Type

Description

name

String

The name of the property to check.

Boolean isPrototypeOf (what:Object)

Checks whether the given object is a prototype of this object.

Parameter

Type

Description

what

Object

The object to check.

Boolean isValid (what:Object)

Reports whether an object is still valid.

Parameter

Type

Description

what

Object

The object to check.

Boolean propertyIsEnumerable (name:String)

Reports whether a given property is enumerable.

Parameter

Type

Description

name

String

The name of the property to check.

String toLocaleString ()

Creates and returns a string representing this object, localized for the current locale. See toString().

String toSource ()

Creates and returns a string representation of this object.

This function serializes the object, so that it can, for example, be passed between engines. Pass the returned string back to eval() to recreate the object. Works only with built-in classes.

String toString ()

Creates and returns a string representing this object.

Many objects (such as Date) override this method in favor of their own implementation. If an object has no string value and no user-defined toString() method, the default method returns [object type], where type is the object type or the name of the constructor function that created the object.

undefined unwatch (name:String)

Removes the watch function of a property.

Parameter

Type

Description

name

String

The name of the property to unwatch.

Object valueOf ()

Retrieves and returns the primitive value of this object.

If the object has no primitive value, returns the object itself. Note that you rarely need to call this method yourself. The JavaScript interpreter automatically invokes it when encountering an object where a primitive value is expected.

undefined watch (name:String, func:Function)

Adds a watch function to a property, which is called when the value changes.

This function can accept, modify, or reject a new value that the user, application, or a script has attempted to place in a property.

Parameter

Type

Description

name

String

The name of the property to watch.

func

Function

The function to be called when the value of this property changes.

This function must three arguments, and return as its result the value to be stored in the property. The arguments are: name: the name of the property that changes. oldValue: The old property value. newValue: The new property value that was specified.