Logical-Operators-In-Javascript
Logical Operators in JavaScript
Logical AND
The Logical AND uses the &&
operator. If all operands are true
it returns true
, otherwise false
is returned.
const a = 3;
const b = -2;
console.log(a > 0 && b > 0);
// expected output: false
Logical OR
The Logical OR uses the ||
operator. Returns true
if one or more of the operands is true.
const a = 3;
const b = -2;
console.log(a > 0 || b > 0);
// expected output: true
#JavaScript