Javascript — If/Else Statements
if
statements let you run code based on conditions. You can use else if
and else
for more logic flows.
let age = 20;
if (age >= 18) {
console.log(\"You can vote\");
} else {
console.log(\"You are too young to vote\");
}