let age = 20;
if (age >= 18) {
console.log("Adult");
}
An if statement checks if a condition is **true**. If it is, the code inside the curly braces { } runs. If it's false, the browser simply skips that block.
let age = 15;
if (age >= 18) {
console.log("Adult");
} else {
console.log("Minor");
}
The else statement acts as a "fallback." It runs only when the if condition is **false**. This ensures that your program always has a response, regardless of the input.