if...else statement. Using the ternary operator can help to condense code, although it is sometimes criticized for contributing to less transparent and readable code compared to the
The ternary operator, as the name implies, requires three operands. The ternary operator statement includes a condition, which is evaluated. The conditional statement is followed by a question mark. Upon evaluation, the operator will execute the code before the colon if the result of the condition is true and the code after the colon if the result of the condition is false.
condition (truthy or falsy) ? `code to execute if truthy` : `code to execute if falsy`;