User Tools

Site Tools


Object

Properties

ECMAScript
Functionconstructor
Objectprototype
QtScript
Object__proto__

Static Methods

ECMAScript
Objectcreate ( Object obj, Object properties=undefined )
ObjectdefineProperties ( Object obj, Object properties )
ObjectdefineProperty ( Object obj, String property, Object descriptor )
ObjectgetOwnPropertyDescriptor ( Object obj, String property )
ArraygetOwnPropertyNames ( Object obj )
ObjectgetPrototypeOf ( Object obj )
Arraykeys ( Object obj )

Constructors

ECMAScript
Object ()

Methods

ECMAScript
BooleanhasOwnProperty ( String property )
BooleanisPrototypeOf ( Object obj )
BooleanpropertyIsEnumerable ( String property )
StringtoLocaleString ()
StringtoString ()
ObjectvalueOf ()
QtScript
void__defineGetter__ ( String propertyName, Function getter )
void__defineSetter__ ( String propertyName, Function setter )

Detailed Description

Example:

var oObject = new Object();
oObject.nMyProperty = 100;

Properties


Function : constructor

Initializes an object.

Example:

var oObject = new Object();

Object : prototype

The prototype of an object.

Example:

var oObject = new Object();
print( oObject.__proto__ === Object.prototype ); // this evaluates to true

Object : __proto__

The undeleteable prototype of an object.

Example:

var oObject = new Object();
print( oObject.__proto__ === Object.prototype ); //true

Static Methods


Object : create( Object obj, Object properties=undefined )

Creates a new Object with the specified prototype obj and properties defined on properties.


Object : defineProperties( Object obj, Object properties )

Adds the named properties described by the given descriptors to an object.

Parameter(s):

  • obj - The object to define the property on.
  • properties - An object whose own enumerable properties serve as descriptors for the properties being defined.

Object : defineProperty( Object obj, String property, Object descriptor )

Defines a property directly on an object and returns the object.

Parameter(s):

  • obj - The object to define the property on.
  • property - The name of the property to define.
  • descriptor - The descriptor for the property being defined.

Object : getOwnPropertyDescriptor( Object obj, String property )

Parameter(s):

  • obj - The object to retrieve the property descriptor from.
  • property - The name of the property to define.

Return Value:

  • A property descriptor of property if it exists on obj, otherwise undefined

Array : getOwnPropertyNames( Object obj )

Parameter(s):

  • obj - The object to retrieve the property names from.

Return Value:

  • An array of string elements corresponding to the properties found directly on obj.

Object : getPrototypeOf( Object obj )

A standard read only implementation of proto.

Parameter(s):

  • obj - The object instance to retrieve the prototype of.

Return Value:

  • The prototype of an object.

Array : keys( Object obj )

Parameter(s):

  • obj - The object to retrieve the property names from.

Return Value:

  • An array of names representing all of the given object's own enumerable properties.

Constructors


Object()

Default Constructor.

Methods


Boolean : hasOwnProperty( String property )

Return Value:

  • true if the object defines property, otherwise false.

Boolean : isPrototypeOf( Object obj )

Parameter(s):

  • obj - The object to check against the prototype chain.

Return Value:

  • true if the object is in the prototype chain of obj, otherwise false.

Boolean : propertyIsEnumerable( String property )

Parameter(s):

  • property - The name of the property to check.

Return Value:

  • true if property exists and is enumerable, otherwise false.

String : toLocaleString()

Return Value:

  • A locale-specific string representation of the object.

String : toString()

Return Value:

  • A string representation of the object.

Object : valueOf()

Return Value:

  • The primitive value of the specified object.

void : __defineGetter__( String propertyName, Function getter )

Installs a getter function for a named property of an object. When the function is invoked, the this object will be the object whose property is accessed.

Parameter(s):

  • propertyName - The name of the property.
  • getter - The function to call to get the value of the property.

Example:

var oObject = new Object();
oObject.__defineGetter__("x", function() { return this._x; });
 
print( oObject.x ); // 123

void : __defineSetter__( String propertyName, Function setter )

Installs a setter function for a named property of an object. When the function is invoked, the this object will be the object whose property is accessed.

Parameter(s):

  • propertyName - The name of the property.
  • getter - The function to call to set the value of the property.

Example:

var oObject = new Object();
oObject.__defineSetter__("x", function(v) { print("setting x to:", v); this._x = v; });
 
oObject.x = 123; // will print "setting x to: 123"