JavaScript String toString() Method

JavaScript String Reference JavaScript String Reference

Example

Return the value of a String object:

var str = "Hello World!";
var res = str.toString();

The result res of will be:

Hello World!

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: 1.1


JavaScript String Reference JavaScript String Reference

Color Picker

colorpicker