English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

JavaScript Boolean Object

Boolean objects are boolean values (trueorfalseis the object wrapper of the)

Boolean() function

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

Boolean(10 < 22) // Return true
Test to see‹/›

Or, you can also use the following syntax:

(10 < 22)// Return true
10 < 22  //Return true
Test to see‹/›

You can test ourIn the JavaScript Boolean tutorialLearn more about Booleans.

Boolean Object Properties

The following table lists the properties of the Boolean object:

PropertiesDescription
constructorReturns a reference to the Boolean function that created the object
prototypeAllow you to add new properties and methods to the object

Boolean Object Methods

The following table lists the methods of the Boolean object:

MethodDescription
toString()Return the value of the object based on its value"true"or"false"as a string
valueOf()Return the original value of the Boolean object