![]() |
VOOZH | about |
In JavaScript, the Comparison Equality Operator (==) is used to compare the values of two operands. It returns true if the values are equal and false otherwise. This operator is known as loose equality because it performs automatic type conversion before comparison.
Syntax:
a==bNote: The equality comparison is symmetric in the sense that a==b is the same as b==a.
[Example 1]: We will use the equality operator on the same data types.
new String() are objects.[Example 2]: We will use the equality operator on different data types.
[Example 3]: We will compare Date with String using the equality operator.