HTML CSS Bootstrap Javascript Icons Python
JavaScript Reference
Overview
JS Reference
JS Array Object JS Boolean Object JS Date Object JS Style Declaration Object JS Error Object JS Global Object JS Math Object JS Number Object JS String Object JS RegExp Object JS Statements
DOM Reference
DOM Attribute DOM Console DOM Document DOM Element DOM Events DOM Event Objects DOM History DOM HTMLCollection DOM Location DOM Navigator DOM Screen DOM Style DOM Window WEB Storage

JavaScript Boolean Reference

The Boolean object is an object wrapper for a boolean value (true or false).

The Boolean() Function

The Boolean() function can be used to find out if an expression is true:

Run code

OR you can also use the following syntax:

Run code

You can learn more about Booleans in our JavaScript Boolean Tutorial.


Boolean Object Properties

The following table lists the properties of the Boolean object:

Property Description
constructor Returns a reference to the Boolean function that created the object
prototype Allows you to add new properties and methods to an object

Boolean Object Methods

The following table lists the methods of the Boolean object:

Method Description
toString() Returns a string of either "true" or "false" depending upon the value of the object
valueOf() Returns the primitive value of the Boolean object