Booleans, null & undefined
Understand true/false values, comparison operators, and JavaScript's two ways of saying 'nothing.'
Step 1 of 6
The simplest data type: true or false
A boolean is a value that can only be one of two things: `true` or `false`. That's it — no maybes, no in-betweens. Booleans are named after George Boole, a mathematician who developed the logic that all computers are built on.
Why do booleans matter? Because every decision your code makes boils down to a yes-or-no question. Is the user logged in? Is the password correct? Is the shopping cart empty? Did the student pass? Each of these is answered by a boolean. When we learn `if` statements in a later module, booleans will be at the heart of every decision.
Think of it this way: Booleans are like light switches — they can only be on (true) or off (false). Every decision in your code comes down to this simple yes-or-no question. An entire computer is built from billions of these tiny on/off switches.
Learn more on MDN
JAVASCRIPTREAD ONLY
CONSOLE
Click "Run" to execute your code...