A Boolean only has two possible values: true or false. That’s it.
It’s like a yes or no question, or an on or off switch.
Why does it have such a funky name? Boolean logic, the holy binary 0 or 1 thing that computing is based on, is named after its inventor George Boole.
Often you use it to check if a variable had a value or not, for example:
var userName = false
There’s no user name. So you can ask the computer to tell the silly user to give you their username.
You can also use comparisons that will give you Boolean results.
x = 7;
y = 5;
alert (x > y); // true
alert (x < y); // false
alert (x != y); // true (x does not equal y)
So that’s my friend the Boolean. He also has a cousin, the Boolean operator (when you actually type Boolean in the code), but that’s the subject for another day.
I hope youUnderstoodThis = true;
