conditional operator and conditional statement code example
Example 1: conditional operator
var age = 26;
var beverage = (age >= 21) ? "Beer" : "Juice";
console.log(beverage); // "Beer"
Example 2: Conditional operator
bCondition1 && bCondition2
var age = 26;
var beverage = (age >= 21) ? "Beer" : "Juice";
console.log(beverage); // "Beer"
bCondition1 && bCondition2