What does a Ternary Operator do?
It simplifies an if…else statement
Write out an example of a Ternary Operator
let isNightTime = true;
if (isNightTime) {
console.log('Turn on the lights!');
} else {
console.log('Turn off the lights!');
}isNightTime ? console.log(‘Turn on the lights!’) : console.log(‘Turn off the lights!’);
Do you need a semicolon after an else statement?
No
Do you need a semicolon after an else if statement?
Yes
Do you need a semicolon after an if statement?
Yes