JavaScript toString() Method
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 |
|---|
JavaScript String object