Begin Web Programming with PHP & MySQL

Advertisements



JavaScript Boolean Object

The Boolean object is an object wrapper of the boolean value true or false. The Boolean object returns false when it is passed with values such as false, 0, empty string(""), null, undefined, or NaN. All other values will set the Boolean object as true.
Syntax:
var bool_value = new Boolean(Value);

Properties of Boolean Object
Property Description
constructor It refers to the function that created the object.
prototype It is used to add new properties and methods to a boolean object.

Methods of Boolean Object
Method Description
toString() The toString() method returns a string containing the source of the Boolean object.
valueOf() It returns the primitive value of a boolean object.
toSource() It returns a string which represents the source code of a boolean object.