== vs ===
Equality check: === is preferred.
Syntax
a === b
Description
== performs type conversion before comparison (can be confusing); === checks for both value and type equality. Always use ===.
Example
Loading editor…
Expected output
true false
When to use?
Safe comparison.
Common mistakes
- ⚠️ == leads to quirks like 0 == "" or 1 == true; === prevents these.