MODULE 3 · Control flow and functions
Reading · 15 min
Conditions
Conditions
Conditions make a program responsive to its input. Keep the question readable so that a future reader can verify the branch quickly.
Learning objectives
- Write an if/else decision
- Use comparison operators intentionally
Choose a branch of logic based on a clear question. Focus on explaining each decision in your own words before relying on a pattern or shortcut.
Example
const score = 82;
const result = score >= 60 ? "pass" : "try again";
console.log(result);Summary
KEY TAKEAWAYS
- Conditions describe decisions.
- Test both the expected and boundary cases.
Reading material
Conditions practice prompt
Use the exercise in this lesson to check your understanding.
Your progress is saved on this device. Sign in to keep it across devices.
