in javascript how to do conditional expression code example
Example: ternary operator javascript
condition ? exprIfTrue : exprIfFalse
//Example
let age = 26;
let beverage = (age >= 21) ? "Beer" : "Juice";
console.log(beverage); // "Beer"
condition ? exprIfTrue : exprIfFalse
//Example
let age = 26;
let beverage = (age >= 21) ? "Beer" : "Juice";
console.log(beverage); // "Beer"