← TechnologyThe essentials of

Object.is(): special cases NaN and negative zero

Publisher: ResumeMaker • 1 source

Published: 22 Oct 2026 13:13 · Updated: 22 Oct 2026 13:13

AI source check: 21 Oct 2026 12:40. This is not editorial approval.

In a few sentences

In brief

The comparison has small but important differences compared with ===.

Useful to know

Object.is() compares whether two values are the same value according to its assigned semantics. Object.is(NaN, NaN) is true, and Object.is(0, -0) is false. In ===, these two examples behave differently . [1]

Do not mechanically replace any comparison with Object.is. First, specify whether the special cases are essential to the task. Two different objects with the same fields do not become the same in content: the comparison remains in identity. A separate algorithm with clear rules is needed to verify a structure.

Sources

For further detail and to check the information:

  1. [1] MDN — Object.is ↗