Ternary Expression
Predict Output Easy
Question
What does this code print?
Code
let age = 16;
let status = age >= 18 ? "adult" : "minor";
console.log(status);
Hint
16 is not >= 18, so the false branch is taken.
Explanation
age is 16. The condition age >= 18 is false (16 < 18). So the ternary returns the false-branch value "minor". The output is: minor
Related Resources
Related Lessons
- Conditions (if/else)
Learn how if/else conditions work.
Look up unfamiliar terms
A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.
Build real projects
Apply what you learned by building guided projects with starter code and solutions.