Comparison with the equality (==) and strict equality (===) operator in Javascript

Nov 18, 2017 00:00 · 81 words · 1 minute read

If the values being compared are not of the same type, the equality operator will perform a type conversion, and then evaluate the values. however, the strict equality operator will compare both the data type and values as-is, without converting one type to the other. Example:

1 == "1" // returns true, because Javascript performs type conversion from string to number.
1 === "1" // returns false, because the types are different and type conversion is not performed.

Ref: