Back to JavaScript

JavaScript Tutorial

Conditional Statements

Run different code based on conditions.

Conditional statements help programs make decisions.

Use if, else if, else, and switch when different cases need different behavior.

javascript
const score = 85;

if (score >= 80) {
  console.log("Great work");
} else {
  console.log("Keep practicing");
}