JavaScript String() Function
- Previous Page parseInt()
- Next Page undefined
- Go Back to the Previous Level JavaScript Global Reference Manual
Definition and Usage
String()
The function converts the value of an object to a string.
Note:String()
The function returns the same value as the toString() of a single object.
Example
Convert different objects to strings:
var x1 = Boolean(0); var x2 = Boolean(1); var x3 = new Date(); var x4 = "12345"; var x5 = 12345; var res = String(x1) + "<br>" + String(x2) + "<br>" + String(x3) + "<br>" + String(x4) + "<br>" + String(x5);
Syntax
String(object)
Parameter Value
Parameter | Description |
---|---|
object | Required. JavaScript Object. |
Browser Support
Function | Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|---|
String() | Support | Support | Support | Support | Support |
- Previous Page parseInt()
- Next Page undefined
- Go Back to the Previous Level JavaScript Global Reference Manual