The Boolean object is used to convert a non-Boolean value to a Boolean value (true or false).
For a complete reference of all the properties and methods that can be used with the Boolean object, go to our complete Boolean object reference.
The reference contains a brief description and examples of use for each property and method
The Boolean object represents two values: "true" or "false".
The Below code creates a Boolean object called myBoolean:
Note: If the Boolean object has no initial value or if it is 0, -0, null, "", false, undefined, or NaN, the object is set to false. Otherwise it is true (even with the string "false")
All the following lines of code create Boolean objects with an initial value of false:
And all the following lines of code create Boolean objects with an initial value of true:
Your Query was successfully sent!