Home / Javascript Tips Generated By ChatGPT / Using the Ternary Operator for Quick Decisions in Javascript The ternary operator is a shorthand for if-else statements. Source Code let age = 20; let beverage = age >= 18 ? "Beer" : "Juice"; console.log(beverage); // "Beer"