all conditional operator code example
Example 1: conditional operator
var age = 26;
var beverage = (age >= 21) ? "Beer" : "Juice";
console.log(beverage); // "Beer"
Example 2: Conditional operator
if (x === 5 || x === 7 || x === 10 ||x === 20) {
// run my code
}