Summary
Returns the primitive value of a String object.
Method of String | |
|---|---|
| Implemented in | JavaScript 1.1 |
| ECMAScript Edition | ECMAScript 1st Edition |
Syntax
string.valueOf()
Parameters
None.
Description
The valueOf method of String returns the primitive value of a String object as a string data type. This value is equivalent to String.toString.
This method is usually called internally by JavaScript and not explicitly in code.
Examples
Example: Using valueOf
x = new String("Hello world");
alert(x.valueOf()) // Displays "Hello world"
See Also
Mozilla Developer Network