if statement abbreviation js && code example
Example 1: shorthand if statment in js
isLoggedIn ? "Logout" : "Login";
Example 2: how to use ternary operator in javascript
var age = 26;
var beverage = (age >= 21) ? "Beer" : "Juice";
console.log(beverage); // "Beer"