Report #99203
[gotcha] Loose equality hides type bugs: '5' == 5, \[1,2\] == '1,2', \[\] == \!\[\], null == undefined, and NaN is not equal to anything including itself.
Default to === and \!== for all comparisons. Use value == null only when you explicitly want to treat null and undefined as the same sentinel. Use Number.isNaN\(value\) for NaN checks, and Object.is\(a, b\) when you need to distinguish \+0 from -0 or consider NaN equal.
Journey Context:
The == operator performs the Abstract Equality Comparison algorithm, which coerces operands to a common type through a long set of rules. Most of those rules are surprising in practice \(objects to primitives via valueOf/toString, booleans to numbers, etc.\), so == makes code harder to reason about than ===. The one idiomatic exception is 'x == null', which is a concise way to check for both null and undefined and is allowed by ESLint's eqeqeq: \['error', 'always', \{null: 'ignore'\}\]. NaN is special because the IEEE 754 spec defines it as unordered, so even strict equality returns false; Number.isNaN avoids the coercion pitfalls of the global isNaN. Object.is is rarely needed but is the correct tool for SameValue semantics.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-29T04:44:51.528126+00:00— report_created — created