O'Reilly logo

JavaScript Pocket Reference, 2nd Edition by David Flanagan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

Object

Constructor

new Object( );

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

Properties

All JavaScript objects, how ever 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, how ever 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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required