Boolean ObjectNameBoolean Object---support for Boolean valuesConstructor
new Boolean(value) Arguments
ReturnsThe newly created Boolean object. Methods
DescriptionBoolean values are a fundamental data type in JavaScript. The Boolean object is an object wrapper around the Boolean value. This Boolean object type exists solely to provide a toString() method to convert Boolean values to strings. When the toString() method is invoked to convert a Boolean value to a string (and it is often invoked implicitly by JavaScript) JavaScript internally converts the Boolean value to a transient Boolean object, on which the method can be invoked. You can create Boolean objects that are not transient by calling the Boolean() constructor method. One reason you might occasionally want to do so is to force a conversion of another value to a Boolean value. Having created a Boolean object, you can use it freely wherever JavaScript expects a primitive Boolean value--JavaScript will automatically invoke the valueOf() method to return the primitive value of the Boolean object. |
|