true representing yes and
false representing no.
boolean is generally used in conditional statements or at place when we have to control the flow example loops, if-else, switch etc.
The Boolean Constructor
Boolean() is a function which can be used to create boolean values.
Boolean() function can receive variables or expressions as arguments.
Lets see an example.
Boolean as Object
Generally Boolean is a primitive data type when created using literal. Example
var bool = true;.
But booleans can be made objects using
new keywords. Example
var boolObj = new Boolean(true);.
Use literals to define boolean because boolean as object is slow
Boolean objects are not equal to boolean literals and also boolean objects are slower.