+ 2

What is the "Boolean" in the js? I didn't under stand it. Please help me..

18th Apr 2017, 6:55 AM
Vigneshwar
3 Réponses
+ 10
Variables are containers for storing data values, remember? Well, these data values can have different types, one of them is the "boolean" type. Examples: 1) The following is a variable called "Age" with a data type of "number" because its number value is 16: var Age = 16; 2) The following is a variable called "Name" with a data type of "string" because its text value is "Vigneshwar": var Name = "Vigneshwar"; 3) The following is a variable called "Male" with a data type of "boolean" because its value is true: var Male = true; Just remember that Booleans can only have 2 values: true or false. And they are often used in conditional testing. For more information about booleans: https://www.w3schools.com/js/js_booleans.asp
18th Apr 2017, 7:55 AM
Pao
Pao - avatar
+ 9
Boolean variables can only hold the values "true" or the value "false". Some other values can be assigned that map to one of the two. Ex: Any number that isn't 0 is treated as assigning true. They're usually used to check if something has(n't) occurred/succeeded or does(n't) exist, and are called flags.
18th Apr 2017, 7:04 AM
Tamra
Tamra - avatar
+ 2
Boolean is a data type. It is used to simple check if something true or false.
18th Apr 2017, 9:29 AM
Cakkavati Kusuma