JavaScript Boolean Object

Last Updated Jul 29, 2015, 07:00:14 PM

JavaScript Boolean Object

The Boolean object in JavaScript has only two values to represent i.e., true or false. This object has initial value as false.

The Boolean object is an object wrapper for a boolean value.


To create the Boolean object, you have to use the above syntax. If the value of parameter is not included or 0, -0, null, false, NaN, undefined, empty string, it will take default value as false.


The value passed as the first parameter is converted to a boolean value

Do not confuse the primitive boolean values true and false with the true and false values of the boolean object.

JavaScript Boolean Object Methods

Method Description Example
toString() toString method is used to convert number to a string Try It Now
valueOf() valueOf()method returns the primitive numeric value represented by the object. Try It Now
toSource() Returns a string containing the source of the Boolean object; you can use this string to create an equivalent object. Try It Now

Here is the list of important JavaScript Native Objects

JavaScript String Object

JavaScript Number Object

Sources and Credits

The source of the content has been referred and updated with Mozilla Developer Network and W3C Organization

Last Updated Jul 29, 2015, 07:00:14 PM

Browser compatibility

Basic support Yes Yes Yes Yes Yes Yes Yes