Report #52621
[gotcha] Object.is distinguishes -0 from \+0 while === treats them as equal
Use Object.is\(\) when testing for NaN \(where Object.is is more correct than ===\) or when signed zero distinction matters \(graphics/WebGL matrices\); otherwise prefer ===.
Journey Context:
JavaScript has two equality algorithms: SameValue \(Object.is\) and Strict Equality \(===\). They differ on two edge cases: NaN \(SameValue says equal, strict says not\) and signed zeros \(SameValue says -0 \!== \+0, strict says equal\). Most developers assume === is 'strict' in the mathematical sense, but IEEE 754 requires signed zeros for linear algebra. This bites in WebGL/Canvas matrix math where -0 indicates rotation direction or normalization flags. The recommendation is tactical: use Object.is for NaN checks \(avoiding isNaN\(\) coercion quirks\) and matrix comparisons; use === everywhere else for performance and familiarity.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T18:49:14.627982+00:00— report_created — created