Important Notice:

Conditional/Ternary Operator

Conditional/Ternary Operator

19 views 1 min read

6. कंडीशनल (टर्नरी) ऑपरेटर (Conditional/Ternary Operator)

if-else का छोटा रूप – तीन operands पर काम करता है।

Example:-

let age = 20;
let status = (age >= 18) ? "Adult" : "Minor";
console.log(status); // "Adult"
// सिंटैक्स: condition ? true_value : false_value

6. Conditional (Ternary) Operator
Shorter form of if-else – works on three operands.

Example:

text

let age = 20; let status = (age >= 18) ? "Adult" : "Minor"; console.log(status); // "Adult" // Syntax: condition ? true_value : false_value

Related Notes