Object

Team-Fly    

 
Webmaster in a Nutshell, 3rd Edition
By Robert Eckstein, Stephen Spainhour
Table of Contents
Chapter 11.  JavaScript


Object Core JavaScript 1.0; JScript 1.0; ECMA v1

The superclass of all JavaScript objects

Constructor

 new Object( ); 

This constructor creates an empty object to which you can add arbitrary properties.

Properties

All JavaScript objects, however they are created, have the following properties.

constructor

A reference to the JavaScript function that was the constructor for the object. JS 1.1; JScript 2.0; ECMA v1.

Methods

All JavaScript objects, however they are created, have the following methods.

hasOwnProperty( propname )

Returns true if the object has a non-inherited property with the specified name. Returns false if the object does not have a property with the specified name , or if it inherits that property from its prototype object. JS 1.5; JScript 5.5; ECMA v3.

isPrototypeOf( o )

Returns true if this object is the prototype of o . Returns false if o is not an object or if this object is not its prototype. JS 1.5; JScript 5.5; ECMA v3.

propertyIsEnumerable( propname )

Returns true if this object has a non-inherited enumerable property with the specified name, and returns false otherwise . Enumerable properties are those that are enumerated by for/in loops . JS 1.5; JScript 5.5; ECMA v3.

toLocaleString( )

Returns a localized string representation of the object. The default implementation of this method simply calls toString( ), but subclasses may override it to provide localization. JS 1.5; JScript 5.5; ECMA v3.

toString( )

Returns a string representation of the object. The implementation of this method provided by the Object class is quite generic and does not provide much useful information. Subclasses of Object typically override this method by defining their own toString( ) method that produces more useful output. JS 1.0; JScript 2.0; ECMA v1.

valueOf( )

Returns the primitive value of the object, if any. For objects of type Object, this method simply returns the object itself. Subclasses of Object, such as Number and Boolean, override this method to return the primitive value associated with the object. JS 1.1; JScript 2.0; ECMA v1.

See Also

Array, Boolean, Function, Number, String


Team-Fly    
Top


Webmaster in a Nutshell
Webmaster in a Nutshell, Third Edition
ISBN: 0596003579
EAN: 2147483647
Year: 2002
Pages: 412

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net