JavaScript String valueOf() Method
❮
Reference
Example
Return the primitive value of a string object:
var str = "Hello World!";
var res = str.valueOf();
Try it Yourself »
Definition and Usage
The valueOf() method returns the primitive value of a String object.
Note: This method is usually called automatically by JavaScript behind the scenes, and not explicitly in code.
Browser Support
Method | |||||
---|---|---|---|---|---|
valueOf() | Yes | Yes | Yes | Yes | Yes |
Syntax
string.valueOf()
Parameters
None |
Technical Details
Return Value: | A String, representing the primitive value of a string |
---|---|
JavaScript Version: | ECMAScript 1 |
❮
Reference