THE WORLD'S LARGEST WEB DEVELOPER SITE

JavaScript String toString() Method

Example

Return the value of a String object:

var str = "Hello World!";
var res = str.toString();
Try it Yourself »

Definition and Usage

The toString() method returns the value of a String object.


Browser Support

Method
toString() Yes Yes Yes Yes Yes

Syntax

string.toString()

Parameters

None.

Technical Details

Return Value: A String, representing the value of a string
JavaScript Version: ECMAScript 1