English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
Boolean objects are boolean values (trueorfalseis the object wrapper of the)
The Boolean() function can be used to find out if an expression is true:
Boolean(10 < 22) // Return trueTest to see‹/›
Or, you can also use the following syntax:
(10 < 22)// Return true 10 < 22 //Return trueTest to see‹/›
You can test ourIn the JavaScript Boolean tutorialLearn more about Booleans.
The following table lists the properties of the Boolean object:
Properties | Description |
---|---|
constructor | Returns a reference to the Boolean function that created the object |
prototype | Allow you to add new properties and methods to the object |
The following table lists the methods of the Boolean object:
Method | Description |
---|---|
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 |