The Boolean object in JavaScript.
var myBooleanVariable = new Boolean(value)
If value is omitted or is 0, -0, null (not 'null'), false (not 'false), NaN (not 'NaN'), undefined (not 'undefined'), or an empty string ("" or ''), then the object has an initial value of false. All other values, including any object or the string "false" will create an object with an initial value of true.
A Boolean object is not the same as the Boolean function.
x = new Boolean(false); if(x); //the condition is true x = false; if(x) //the condition is false
x = Boolean(expression) //preferred x = new Boolean(expression) //don't use
.constructor. Specifies the function that creates an object's prototype.
.prototype. Defines a property that is shared by all Boolean objects.
.toSource(). Returns an object literal representing the specified Boolean object; you can use this value to create a new object. Overrides the Object.toSource method.
.toString(). Returns a string representing the specified object. EG: may return "true". Overrides the Object.toString method.
.valueOf(). Returns the primitive value of a Boolean object. EG: may return true. Overrides the Object.valueOf method.
2007-08-08 17:50:44Z