Conditionals
1. The (classic) IF Statement
if (condition) {
// code to be executed if the condition is true
}let age = 18;
if (age >= 18) {
console.log("You are eligible to vote.");
}2. The (more complete) IF … ELSE Statement
if (condition) {
// code to be executed if the condition is true
} else {
// code to be executed if the condition is false
}3. The (perfect shape) IF … ELSE IF … ELSE Statement
4. The (alternative) SWITCH Statement
Help us improve the content 🤩
Last updated