condition ? value1 : value2 — a compact if/else.
- Category: JS Control Statements — part of the JavaScript Tutorial on GoCareerGo
- Read the short summary above, then check the linked docs for full syntax/behaviour
- Interview tip: be ready to explain "Ternary Operator" in one sentence, then back it up with a tiny example
// Ternary Operator — minimal example
console.log("Ternary Operator");Tip
Quick recall: "Ternary Operator" — condition ? value1 : value2 — a compact if/else.