What operator in JavaScript is used for strict equality comparison?

The story behind the answer

The JavaScript operator used for strict equality comparison is ===.

Strict equality compares two operands without performing the implicit type conversion associated with the loose equality operator, ==. Thus, 5 === 5 is true, but 5 === "5" is false because one operand is a number and the other is a string. The result of the comparison is always a Boolean value.

The operator is called “triple equals” and is commonly preferred because its rules are more predictable. The related !== operator tests strict inequality. By contrast, == may convert values before comparing them, so 5 == "5" evaluates to true. Neither === nor == performs a deep structural comparison of separate objects: two independently created objects with identical properties are still unequal because they have different identities.

There are special numeric cases. Strict equality considers +0 and -0 equal, while NaN is not equal to itself. Object.is() differs on those edge cases, treating NaN as equal to itself and distinguishing +0 from -0.

Source: Wikipedia · fact-checked Aug. 2026

Add question to a list

Choose a list to keep this question in: