if-else
decisions are so common in coding languages that most have some sort of shortcut to create them. In JavaScript, this shortcut is referred to as a ternary
, and is the only operator that uses two symbols.
The ternary operator is not merely a shortcut: it is an expression that returns a value, making it extremely powerful in the right hands.