Boolean Object
- In JavaScript, a boolean is a primitive data type that represents one of two values: true or false.
- Booleans are typically used for making decisions and controlling the flow of a program.
The boolean object is created by using the boolean constructor:
Boolean b=new Boolean(value);
- The default value is false.
Example:
<script>
document.write(10<20);//true
document.write(10<5);//false
</script>
Boolean properties:
Constructor:
- The constructor will return the reference of the boolean function.
Prototype:
- prototype will enable to add of properties and methods in a boolean prototype.
Boolean methods: