JavaScript toString()Method

String 对象参考手册JavaScript String Object

Examples

Returns the value of a String object:

var str = "Example"; var res = str.toString();

resOutput:

Example

Try it Yourself »

Definition and Usage

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


Browser Support

The numbers in the table specify the first browser version that fully supports the property.

Method
toString() Yes Yes Yes Yes Yes

Syntax

string.toString()

Parameter Values

None.

Return Value

Type Description
String

A string.

Technical Details

JavaScript Version: ECMAScript 1


String 对象参考手册JavaScript String Object

Other Extensions