valueOf() (Method)

Returns the primitive equivalent value of the receiving object.

Availability:

JavaScript - 1.1
JScript - 3.0
Internet Explorer- 4.0
Netscape version - 3.0
Property/method value type:Primitive value
JavaScript syntax:-myObject.valueOf()

The primitive value of the receiving object is returned by this method.

This method is supported by virtually all objects due to the fact that it is available as a method of the Global object in Netscape. Therefore it is inherited into the scope chain for every script and function (method).

Host implementations will generally override this inherited support and provide specialized output routines that yield a reasonable value.

Most likely the value will be a String primitive but it need not be. It could be any of the built-in core primitive data types as specified in the ECMA-262 standard.

See also:Array.valueOf(), Boolean.valueOf(), Date.valueOf(), Number, Number.valueOf(), Object.valueOf(), String.valueOf()