Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

JavaScript Boolean Object

JavaScript Boolean Object


The Boolean object converts non-Boolean values to Boolean values (true or false).


Online example

Check Boolean values
Check whether a Boolean object is true or false.


Complete Boolean object reference

We provide JavaScript Boolean object reference, which includes all properties and methods available for Boolean objects.

The reference contains detailed descriptions of each property and method, along with related examples.


Create a Boolean object

A Boolean object represents two values: "true" or "false"

The following code defines a Boolean object named myBoolean:

var myBoolean=new Boolean();

If a Boolean object has no initial value, or its value is:

then the object's value is false. Otherwise, its value is true (even when the variable value is the string "false")!