JavaScript Logical Operator With Example
JavaScript Operators Definition:
An operator that performs some operation on single or multiple operands and produces a result is called Operators.
An Operators are symbols or keyword that enable JavaScript to perform some sort of actions.
JS Logical Operators
The logical operators are typically used to combine conditional statements
Operator | Name | Example | Result |
---|---|---|---|
&& |
And | x && y |
True if both x and y are true |
|| |
Or | x || y |
True if either x or y is true |
! |
Not | !x |
True if x is not true |
Example:
Result:
2020 is a leap year.
Read Also:
- JS-Arithmetic Operators
- JS-Comparison Operators
- JS-Assignment Oerators
- JS-Conditional Operators (or) ternary Operator
- JS-Bitwise Operator
- JS-Increment Decrement Operator