TypeScript supports the following comparison operators. To understand the examples, you must assume that variable A holds 10 as value and variable B holds 20 as value:
Operator |
Description |
Example |
== |
Checks whether the values of two operands are equal or not. This operator uses type coercion. If yes, then the condition becomes true. |
(A == B) is false. A == "10" is true. |
=== |
Checks whether the value and type of two operands are equal or not. This operator doesn't use type coercion. If yes, then the condition becomes true. |
A === B is false. A === "10" is false. |
!= |
Checks whether the value of two operands are equal or not. If the values are not equal, then the condition becomes true. This operator ... |