Report #12196
[gotcha] === treats NaN as not equal to itself and considers -0 and \+0 equal, which breaks identity checks for certain algorithms
Use Object.is\(\) when you need to distinguish -0 from \+0 \(graphics, mathematical libraries\) or when checking for NaN equality without isNaN\(\). For general equality, continue using ===.
Journey Context:
IEEE 754 floating point specifies that NaN \!== NaN. JS follows this for ===. However, Object.is\(\) implements SameValue algorithm used by Maps and Sets for key equality, which treats NaN === NaN and distinguishes -0 and \+0. This matters for memoization caches where -0 and \+0 might produce different results in downstream math, or when using NaN as a sentinel value in Map keys. Most code doesn't need this, but when you do, nothing else works.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T15:18:37.647660+00:00— report_created — created