JavaScript : Logical Operators

  1. And Operator: & &
  2. Or Operator: ||
  3. Not Operator: !
Logical operators are typically used with Boolean (logical) values. When they are, they return a Boolean value. However, the & & and || operators actually return the value of one of the specified operands, so if these operators are used with non-Boolean values, they may return a non-Boolean value: as the specification points out in section 12.12: The value produced by a & & or || operator is not necessarily of type Boolean. The value produced will always be the value of one of the two operand expressions.

And Operator: & &

The logical AND operator ( & &) returns true if the expression to the both sides of the operator evaluates to true.

Or Operator:

The logical OR operator returns false if the expression to the both sides of the operator evaluates to false.

Not Operator: !

If the expression evaluates to true, the result of the logical NOT operator (!) is false. If the expression evaluates to false, the result is true.