This operator for a set of operands is true if and only if one or more of its operands is true
const num1 = 10, num2 = 20; true || false; // true false || false; // false false || num1; // 10 0 || num2; // 20 "text" || true // "text" num1 > 0 || num2 < 0 // true
This operator for a set of operands is true if and only if all of its operands are true
const num1 = 10, num2 = 20; true && true; // true true && false; // false true && num1; // 10 num1 && num2; // 20 "text" && (num1 + num2) // 30 num1 > 0 && num2 < 0 // false
This is a logical operator that returns its right-hand side operand when its left-hand side operand is null or undefined, and otherwise returns its left-hand side operand
undefined ?? 10; // 10 null ?? 20; // 20 false ?? num1; // false 0 ?? num2; // 0
This operator used to explicitly force the conversion of any value to the corresponding boolean primitive.
!!10; // true !!{}; // true !!""; // false !!0; // false
It is not possible to combine both the AND (&&) and OR operators (||) directly with ??