Boolean() constructor

The Boolean() constructor is used to create Boolean objects.

Try it


new Boolean()
new Boolean(value)


value Optional

The initial value of the Boolean object.


Creating Boolean objects with an initial value of false

var bNoParam = new Boolean();
var bZero = new Boolean(0);
var bNull = new Boolean(null);
var bEmptyString = new Boolean('');
var bfalse = new Boolean(false);

Creating Boolean objects with an initial value of true

var btrue = new Boolean(true);
var btrueString = new Boolean('true');
var bfalseString = new Boolean('false');
var bSuLin = new Boolean('Su Lin');
var bArrayProto = new Boolean([]);
var bObjProto = new Boolean({});


ECMAScript Language Specification
# sec-boolean-constructor

Browser compatibility

BCD tables only load in the browser

See also