JavaScript toString () method
Examples
Converts a Boolean value to a string:
var bool = new Boolean(1);
var myvar = bool.toString();
var myvar = bool.toString();
myvar output:
true
try it"
Definition and Usage
toString () method to convert a logical value to a string and returns the result.
Note: When you need to convert Boolean objects to a string of circumstances JavaScript will automatically call this method.
Browser Support
All major browsers support toString () method
grammar
boolean.toString()
Return Value
Type | 描述 |
---|---|
String | "true" 或者 "false" |
technical details
JavaScript version: | 1.1 |
---|