String.valueOf() (Method)

Returns the primitive value of the object.

Availability:

ECMAScript edition - 2
JavaScript - 1.1
JScript - 3.0
Internet Explorer - 4.0
Netscape - 3.0
Property/method value type:Number primitive
JavaScript syntax:-myString.valueOf()

The numeric equivalent of the string value is returned.

In the case of a String object, the valueOf() method returns the same thing as the toString() method.

This is proven by taking a string object and then using the == or === operators to compare the two values myString.toString() and myString.valueOf().

See also:Cast operator, String.prototype, String.toString(), valueOf()

Cross-references:

ECMA 262 edition 2 - section 15.5.4.3

ECMA 262 edition 3 - section 15.5.4.3