The ternary operator is a shortcut for if-else statements.
It has the form:
condition ? expressionIfTrue : expressionIfFalse
let age = 18;
let status = (age >= 18) ? 'Adult' : 'Minor';
console.log(status); // 'Adult'
let score = 75;
let result = (score >= 50) ? 'Pass' : 'Fail';
console.log(result); // 'Pass'
Click the button to see the ternary operator in action: