Javatpoint Logo

91-9990449935

 0120-4256464

JavaScript Boolean

JavaScript Boolean is an object that represents value in two states: true or false. You can create the JavaScript Boolean object by Boolean() constructor as given below.

The default value of JavaScript Boolean object is false.

JavaScript Boolean object provides properties and methods also.

JavaScript Boolean Properties

PropertyDescription
constructorreturns the reference of Boolean function that created Boolean object.
prototypeenables you to add properties and methods in Boolean prototype.

JavaScript Boolean Methods

MethodDescription
toSource()returns the source of Boolean object as a string.
toString()converts Boolean into String.
valueOf()converts other type into Boolean.