JavaScript String() Function
JavaScript Global Functions
Definition and Usage
The String() function converts the value of an object into a string.
Syntax
String(object)
| Parameters | Description |
|---|---|
| object | Required. A JavaScript object. |
Browser support





All major browsers support the String() function.
Tips and Notes
Note: The String() function returns the same value as the toString() method of a string object.
Example
Example
Convert different objects to strings:
The output of the above example is:
Try it »
JavaScript Global Functions