ternary operator

A JavaScript expression made of a condition, a question mark and two options separated by a colon, giving the first option when the condition is truthy and the second otherwise.

In more detail

It is the only JavaScript operator that takes three operands, hence the name. Conditional types borrow the same syntax at the type level.

Related terms

Taught in

References