A Boolean object represents any value that evaluates to true or false. By and large, you don't have to worry about the Boolean object because the browsers automatically create such objects for you when you assign a true or false value to a variable.
There are two property:
1 constructor property
2 prototype property
1 constructor property
This is a reference to the function that created the instance of a Boolean objectthe native Boolean( ) constructor function in browsers.
Example:1
if (myVar.constructor == Boolean)
{
// process native string
}
2 prototype property
It is the property of the static Boolean object. Use the prototype property to assign new properties and methods to future instances of a Boolean value create in the current document.
Example:2
Boolean.prototype.author = "Vyom";
Method
toString( )
valueOf( )
toString( )
Returns the object's value as a string type. We do not need this method in practice, because the browsers automatically convert Boolean values to strings when they are needed for display in alert dialogs or in-document rendering.
Returned Value
true
false
valueOf( )
Returns the object's value as a Boolean data type.
Returned Value
true
false
Share And Enjoy:These icons link to social bookmarking sites where readers can share and discover new web pages.