Ternary operator - mmedrano9438/peripheral-brain GitHub Wiki
conditional (ternary) operator is the only JavaScript operator that takes three operands: a condition followed by a question mark (?), then an expression to execute if the condition is [truthy] followed by a colon (:), and finally the expression to execute if the condition is [falsy]. This operator is frequently used as an alternative to an [if...else] statement.
function getFee(isMember) { return isMember ? '$2.00' : '$10.00'; }
console.log(getFee(true)); // Expected output: "$2.00"
console.log(getFee(false)); // Expected output: "$10.00"
console.log(getFee(null)); // Expected output: "$10.00"