JavaScript String valueOf() Method
THE WORLD'S LARGEST WEB DEVELOPER SITE

JavaScript String valueOf() Method

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