Boolean() (Constructor)

A Boolean object constructor.

Availability:

ECMAScript edition - 2
JavaScript - 1.1
JScript - 3.0
Internet Explorer - 4.0
Netscape - 3.0
Property/method value type:Boolean object
JavaScript syntax:-new Boolean()
-new Boolean(aValue)
Argument list:aValueA value to be converted to a Boolean object.

The Boolean() constructor is used to manufacture new instances of the built-in Boolean object.

When the Boolean() constructor is called by the new operator, it initializes a brand new Boolean object instance.

The value of the new Boolean object instance is the same as the Boolean value yielded by the type conversion of the Boolean() constructor's parameter.

Value:Result:
No valueAlways false
undefinedAlways false
nullAlways false
BooleanNo conversion, the input value is returned unchanged
NumberThe result is false if the argument is 0 or NaN, otherwise it is true
StringZero length strings return false otherwise the result is true
ObjectAlways true

The result of calling the constructor is a Boolean object whose value is true or false depending on the input value. If the value-input parameter is omitted, then a Boolean object with value false is returned by default.

Warnings:

See also:Constructor function, constructor property, Global object, new, Object constant, Object()

Cross-references:

ECMA 262 edition 2 - section - 15.1.3.5

ECMA 262 edition 2 - section - 15.6.1

ECMA 262 edition 2 - section - 15.6.2

ECMA 262 edition 2 - section - 15.6.3

ECMA 262 edition 2 - section - 15.6.3.1

ECMA 262 edition 3 - section - 15.6.2