Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

JavaScript toString() Method

JavaScript toString() Method

String Object Reference JavaScript String object

Example

Returns the value of a String object:

var

str

=

"

Runoob

"

;

var

res

=

str

.

toString

(

)

;

res Output result:

Runoob

Try it »


Definition and Usage

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


Browser support

The numbers in the table indicate the first browser version that supports this property.

Method
toString() Yes Yes Yes Yes Yes

Syntax



string.toString()

Parameter value

none.

Return Value

Type Description
String

A string.

Technical Details

JavaScript version: ECMAScript 1

String Object Reference JavaScript String object