Day 25 at Cudose Creative Agency — Conditionals, Logic & Decision-Making in JavaScript

Today’s session was about logic and conditionals “One of the brains” of JavaScript — where decisions happen, branches split, and your code starts behaving intelligently. We focused on how JavaScript evaluates conditions and chooses different execution paths.
Let’s break it down
---
1. Conditional Statements — The Core of Decision Making
Conditionals help JavaScript answer questions like:
“Should I run this code?”
“Should I skip it?”
“What happens next?”
The basic structure:
if (condition) {
// run this
}
Example:
if (age >= 18) {
console.log("You can vote");
}
---
2. else & else if — Multiple Pathways
When one condition fails, else if lets you test another.
else is your “fallback” for everything else.
if (score >= 70) {
console.log("A");
} else if (score >= 50) {
console.log("C");
} else {
console.log("F");
}
---
3. Logical Operators — AND, OR, NOT
JavaScript combines conditions using:
&& (AND) – both must be true
|| (OR) – at least one must be true
! (NOT) – flips a boolean
Example:
if (age > 18 && country === "Nigeria") {
console.log("Eligible");
}
---
4. The Ternary Operator — Short, Clean Decisions
This is the compact version of an if/else.
condition ? valueIfTrue : valueIfFalse;
Example:
let status = isOnline ? "Active" : "Offline";
Clean, quick, readable.
---
5. switch Case — When You Have Many Options
switch helps when you’re checking one value against many possibilities.
switch(day) {
case "Monday":
console.log("Work mode!");
break;
case "Saturday":
console.log("Rest!");
break;
default:
console.log("Unknown day");
}
It keeps your code cleaner than writing 10 else if statements.
---
🎯 Final Thoughts
Today’s class leveled up our ability to write dynamic code — code that thinks, chooses, and adapts. From simple if conditions to advanced logical combinations and elegant ternaries, we learned the tools that bring real intelligence into JavaScript programs.




