TypeScript logical operators are similar to what we have learned in JavaScript logical operators. These operators help in comparing boolean
expressions and producing a single boolean
value as result.
1. Logical Operators
Operator | Description | |
---|---|---|
Logical AND operator – && |
If both operands (or expressions) are true , then result will be true , else false .
|
|
Logical OR operator – || |
If any of the two operands (or expressions) are true , then result will be true , else false .
|
|
Logical NOT operator – ! |
It is used to reverse the logical state of its operand. It converts true to false , and vice-versa.
|
Happy Learning !!
Comments