3. Data Types

3.3. Boolean


          It is either true or false as a value. 

          In programming, Boolean values are exceptionally widely used for when a value can change between yes or no, on and off, or true and false, Boolean values are exceptionally commonly used in programming. Booleans will express the current state of anything which is likely to change.

          We might use a Boolean, for example to show whether or not a checkbox is verified. 

var IsChecked= true; 

          Booleans are often used to check whether two things are similar or whether a math conditions result is true or false.

/* Verify if 7 is greater than 8 */ 

7 > 8; // results false 

/* Verify if a variable is equal to a string */ 

var favcolor = "Blue";

favcolor === "Blue"; // results true