Object.valueOf() (Method)

The primitive numeric value of the object.


ECMAScript edition - 2
JavaScript - 1.1
JScript - 3.0
Internet Explorer - 4.0
Netscape - 3.0
Netscape Enterprise Server - 2.0
Opera - 3.0
Property/method value type:Depends on the object value
JavaScript syntax:-myObject.valueOf()

As a general rule, the valueOf() method for an object simply returns the this property of the object itself. However, the object may be a wrapper for a host object some kind. It may therefore have been created by invoking the Object constructor. In that case, the host object should be returned in an ECMA-compliant implementation.

Implementations may choose to return the this property of an object or some other value if they choose.

The result of this method will be implementation- and object-dependant. The native core objects are well defined and will return predictable value types. Generally these will be defined by ECMA or W3C standards. It is up to the hosting environment to provide the valueOf() interface to its own suite of objects.

See also:Cast operator, Object.prototype, valueOf()


ECMA 262 edition 2 - section -

ECMA 262 edition 2 - section -

ECMA 262 edition 3 - section -