Boolean Object (JavaScript)

Creates a new Boolean value.


boolObj = new Boolean([boolValue])  


Required. The variable name to which the Boolean object is assigned.

Optional. The initial Boolean value for the new object. If boolvalue is omitted, or is false, 0, null, NaN, or an empty string, the initial value of the Boolean object is false. Otherwise, the initial value is true.


The Boolean object is a wrapper for the Boolean data type. JavaScript implicitly uses the Boolean object whenever a Boolean data type is converted to a Boolean object.

You rarely instantiate the Boolean object explicitly.


The following table lists the properties of the Boolean object.

Property Description
constructor Property Specifies the function that creates a Boolean.
prototype Property Returns a reference to the prototype for a Boolean.


The following table lists the methods of the Boolean object.

Method Description
toString Method Returns a string representation of a Boolean.
valueOf Method Gets a reference to the Boolean.


Supported in the following document modes: Quirks, Internet Explorer 6 standards, Internet Explorer 7 standards, Internet Explorer 8 standards, Internet Explorer 9 standards, Internet Explorer 10 standards, Internet Explorer 11 standards. Also supported Store apps (Windows 8 and Windows Phone 8.1). See Version Information.