JavaScript Boolean Object

JavaScript Boolean Object
Boolean object is a standard object of the JavaScript that allows us to manipulate the value of boolean type. Here is the syntax used to create booelan objects:
var x = new Boolean (parameters)
Parameters can be can be a value (True or False) or can be an expression, which expression shall be calculated as a boolean value. If no value parameter passed or the value 0 or an empty string or null or undefined or NaN (Not a Number), boolean value will be initialized to False. Instead the object will have the boolean True value.
The following table lists some standard methods of the Boolean object:

toSource () method is sent back to the source code that allows us to create boolean objects

toString () This method sends back the string associated with the instruction to create a Boolean object

valueOf () This method returns a boolean value of the origin of the object


Post a Comment