← Home

What Is a Boolean?

· 1 min read

🧪 Concept:

A Boolean is a type of value that’s either true or false. That’s it — just those two options.

Booleans are used to answer yes-or-no questions in code, like:

let isSunny = true;
let hasUmbrella = false;

These values are especially useful when making decisions with if statements or controlling logic in your program.

🧰 Why It Matters:

Booleans are the building blocks of logic in code. They help your program know what to do — and when.

🎉 Quick Challenge:

Try creating a couple of Boolean values about yourself:

let likesPizza = true;
let hasCat = false;

Then use one in an if statement:

if (likesPizza) {
  console.log("Same here 🍕");
}

🧠 Fun Analogy:

A Boolean is like a light switch — it’s either ON or OFF. No maybes.

📚 Further Reading:

▪ MDN Docs – Boolean
W3Schools – JavaScript Booleans

Subscribe to my feed to follow along. I’ll keep the lessons short and sweet.

What Is a Return Statement?