Conditions
An if statement runs code only when its condition is true. Add else if and else for other cases.
Example
const score = 72;
if (score >= 70) {
console.log("Distinction");
} else if (score >= 50) {
console.log("Pass");
} else {
console.log("Try again");
}Exercise
Run the code when age is at least 18.
(age >= 18) {
console.log("Adult");
}Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.