JavaScript Boolean Object

Boolean objects are used to convert non-Boolean values to Boolean values (true or false).


Online Examples

Check boolean values
checks whether the boolean object is true or false.

Complete Boolean object references

We provide a Reference Manual for JavaScript Boolean Objects, which includes all the properties and methods available for Boolean objects.

The manual contains a detailed description of each property and method, as well as related examples.

Create a Boolean object

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

The following code defines a Boolean object named myBoolean:

var myBoolean=new Boolean();

if the boolean object has no initial value or its value is:

  • 0

  • -0

  • null

  • ""

  • false

  • undefined

  • NaN

Then the value of the object is false. otherwise, its value is true (even when the variable value is the string "false")!