true false ternary operator code example
Example 1: conditional operator
var age = 26;
var beverage = (age >= 21) ? "Beer" : "Juice";
console.log(beverage); // "Beer"
Example 2: ternaire javascript
(isMember ? '$2.00' : '$10.00')
var age = 26;
var beverage = (age >= 21) ? "Beer" : "Juice";
console.log(beverage); // "Beer"
(isMember ? '$2.00' : '$10.00')