Report #75300
[gotcha] === treats NaN as not equal to itself and treats \+0 and -0 as equal, breaking identity checks
Use Object.is\(\) for identity comparisons when NaN or signed zero matters \(e.g., React keys, Map/Set lookups, memoization cache keys\); use === only when NaN should be considered distinct from itself or when signed zero distinctions don't matter
Journey Context:
IEEE 754 floating-point defines NaN as unequal to itself, and JavaScript preserves this in \`===\`. Additionally, \`\+0 === -0\` despite them behaving differently in division \(\`1/\+0\` is Infinity, \`1/-0\` is -Infinity\). This causes bugs in memoization libraries \(e.g., Reselect, React.memo\) where \`NaN\` as a dependency creates infinite re-renders or cache misses, and where \`-0\` keys fail Map lookups against \`\+0\` entries. \`Object.is\(\)\` implements the ECMAScript 'SameValue' algorithm \(used internally by Map and Set\) to fix these discrepancies.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T08:59:26.570226+00:00— report_created — created