Javascript Booleans

Javascript Booleans

Boolean is a true/false system of logic on which digital circuits would later be based. Booleans take one of two values: true or false.

Comparison expressions such as   a < b  evaluate to a Boolean value depending on whether the comparison is true of false.





Boolean Object :-

It is possible to define a Boolean value  using an Object constructor :

var test=new Boolean(false);

Primitive type constructors such as Boolean () are not appropriate, though as we preview here we can use them to explicitly cast a value into the Boolean type.

var val=5;

alert(typeof  val)             // number

alert(val)                             //5


alert(typeof val);             // Boolean

alert(val);                            //true

Follow Us

Contact Us

Back to Top