if, else if and else
Use if to run code when a condition is true, else if for more checks and else for the default. Early returns keep chains flat and readable.
Example
const score = 72;
if (score >= 90) console.log("A");
else if (score >= 70) console.log("B");
else console.log("C");Exercise
Alternative branch.
if (x) {} {}
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.