JavaScript toString() Method
Example
Converts a boolean value to a string:
var bool = new Boolean(1);
var myvar = bool.toString();
myvar Output result:
true
Try it »
Definition and Usage
The toString() method converts a boolean value to a string and returns the result.
**Note:** JavaScript automatically calls this method when a Boolean object needs to be converted to a string.
Browser support





All major browsers support the toString() method
Syntax
boolean
.toString()
Return Value
| Type | Description |
|---|---|
| String | "true" or "false" |
Technical Details
| JavaScript version: | 1.1 |
|---|
JavaScript Boolean object