📚 › JavaScript: make pages do things
5. Decisions with if and else
An if statement runs code only when its condition is true. else runs when it is false, and else if checks another condition.
if (score >= 50) checks whether the score is 50 or more.
Show example
let age = 20;
if (age >= 18) {
console.log("adult");
} else {
console.log("minor");
}
✍️ Your turn
Let score = 72. Print pass if the score is 50 or more, otherwise fail.