JavaScript Boolean Object
The Boolean object is used to convert a non-Boolean value to a Boolean value (true or false).
 |
Try it Yourself - Examples |
Check Boolean value
Check if a Boolean object is true or false.
Complete Boolean Object Reference
For a complete reference of all the properties and methods that can be used with
the Boolean object, go to our complete Boolean object reference.
The reference contains a brief description and examples of use for each property and method!
Create a Boolean Object
The Boolean object represents two values: "true" or "false".
The following code creates a Boolean object called myBoolean:
var myBoolean=new Boolean(); |
Note: If the Boolean object has no initial value or if it is 0, -0, null, "", false, undefined,
or NaN, the object is set to false. Otherwise it is true (even with the string "false")!
All the following lines of code create Boolean objects with an initial value of false:
var myBoolean=new Boolean();
var myBoolean=new Boolean(0);
var myBoolean=new Boolean(null);
var myBoolean=new Boolean("");
var myBoolean=new Boolean(false);
var myBoolean=new Boolean(NaN); |
And all the following lines of code create Boolean objects with an initial value of true:
var myBoolean=new Boolean(1);
var myBoolean=new Boolean(true);
var myBoolean=new Boolean("true");
var myBoolean=new Boolean("false");
var myBoolean=new Boolean("Richard"); |
Stylus Studio® 2011 XML Enterprise Suite raises the bar for productivity in XML development tools.
Millions of XML developers and data integration specialists turn to Stylus Studio's comprehensive and
intuitive XML toolset to tackle today's advanced XML data transformation and aggregation challenges.
|
- XML Pipeline Editor, Debugger and Code Generator
- DataDirect XML Converters
- XQuery Mapper, Editor, Debugger, and Profiler
- XSLT Mapper, Editor, Debugger, Designer, and Profiler
- Java and C# for .Net Code Generation
- XML Schema Designer With Documentation Generator
- XML Editor With Full XPath Integration
Download a free trial now
|
|