JavaScript valueOf() Method
JavaScript String object
Definition and Usage
The valueOf() method can return the primitive value of a String object.
Note: The valueOf() method is usually called automatically by JavaScript in the background, rather than being explicitly written in the code.
Syntax
string
.valueOf()
Browser support





All major browsers support the valueOf() method
Example
Example
Returns the primitive value of a String object:
The output of the above example is:
Hello world!
Try it »
JavaScript String object