Thuta Learning
BasicProgrammingbeginner

JS If...Else

Relax. We'll talk through this in plain words — no textbook voice.

if...else statements check whether a given condition is true or false, then run different blocks of code accordingly.

javascript
const time = 14;

if (time < 12) {
  console.log("Good morning!");
} else if (time < 18) {
  console.log("Good afternoon!");
} else {
  console.log("Good evening!");
}
You should see
Good afternoon!
JS If...Else | Thuta Learning