The Boolean object is an object wrapper for a boolean value. The Boolean object is a core object.
new Boolean(value)
value
The initial value of the Boolean object. The value is converted to a boolean value, if necessary. If value is omitted or is 0, null, false, or the empty string (""), the object has an initial value of false. All other values, including the string "false", create an object with an initial value of true.
Use a Boolean object when you need to convert a non-boolean value to a boolean value. You can use the Boolean object any place JavaScript expects a primitive boolean value. JavaScript returns the primitive value of the Boolean object by automatically invoking the valueOf method.
The following examples create Boolean objects with an initial value of false:
bNoParam = new Boolean() bZero = new Boolean(0) bNull = new Boolean(null) bEmptyString = new Boolean("") bfalse = new Boolean(false)
The following examples create Boolean objects with an initial value of true: