new Boolean(value)
The value to be held by the Boolean object. This argument will be converted to a Boolean value, if necessary. The values 0, null and the empty string "" are all converted to false. All other values, including the string "false", are converted to true.
The newly created Boolean object.
Return "true" or "false", depending on the Boolean value represented by the Boolean object.
Return the Boolean value represented by the Boolean object.
Boolean 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.
This HTML Help has been published using the chm2web software. |