JavaScript Boolean toString() Method
❮ JavaScript Boolean Reference
Example
Convert a Boolean value to a string:
var bool = true;
var x = bool.toString();
Try it Yourself »
Definition and Usage
The toString() method returns a boolean value as a string.
Note: This method is called by JavaScript automatically whenever a boolean is used in a string operation.
Browser Support
Method | |||||
---|---|---|---|---|---|
toString() | Yes | Yes | Yes | Yes | Yes |
Syntax
boolean.toString()
Parameters
None. |
Technical Details
Return Value: | A String, either "true" or "false" |
---|---|
JavaScript Version: | ECMAScript 1 |
❮ JavaScript Boolean Reference