Logical Operators
Operator | Description | JS Example |
---|---|---|
&& | and | (a == 2) && (b == 5) |
|| | or | (a == 2) || (b == 5) |
! | not | !(a == 2) |
Tutorials
Examples
and operator
let a = true;
let b = false;
let output = a && b;
console.log(output);
or operator
let a = true;
let b = false;
let output = a || b;
console.log(output);
not operator
let a = true;
let output = !a;
console.log(output);