toString
Summary
Returns a string representation of a Boolean object.
Syntax
boolean.toString()
- boolean
- Required. An object for which to get a string representation.
Return Value
If the Boolean value is true , returns "true". Otherwise, returns "false".
Examples
The following example illustrates the use of the toString method.
var s = new Boolean(0);
document.write(s.toString());
// Output: false;
Create a Boolean variable and convert it to a string
// Create a Boolean Variable
var flag = new Boolean(true);
// Convert the variable to a string
var myVar = flag.toString();
// myVar returns the string "true"
See also
Specification
Boolean Objects ECMAScript® Language Specification Standard ECMA-262 5.1 Edition / June 2011
Attributions
Microsoft Developer Network: Article