Ternary operator in JavaScript
Ternary operator can be used as a shortcut for if...else... statement. Here is the syntax for the ternary operator Boolean Expression that returns true or false ? Statements to execute if true : Statements to execute if false The following example checks if the number is even or odd.