Boolean() constructor

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


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 (ECMA-262)
The definition of 'Boolean constructor' in that specification.

Browser compatibility

BCD tables only load in the browser

See also