JS equality explorer
Type two JavaScript values and see how ==,===, andObject.is compare them — with a step-by-step breakdown of loose equality coercion.
Your inputs never leave the browser — values are parsed safely, withouteval.
~~~
Classic gotchas
~~~
Value A
Value B
~~~
Results
| Operator | Result |
|---|---|
A == B | |
A === B | |
Object.is(A, B) |
Truthiness
| Value | Truthy? |
|---|---|
| A | |
| B |
== coercion steps
~~~
About this tool
JavaScript has two equality operators. Strict equality (===) compares type and value with no conversion. Loose equality (==) coerces types first — which leads to surprises like'' == 0 being true.
Object.is is like=== except it treatsNaN as equal to itself and distinguishes+0 from-0. Use the presets to walk through the comparisons that trip people up in interviews and code reviews.
~~~
Read more
- JavaScript equality operators — == vs === explained
- The JavaScript double negation operator — truthiness in practice
- JavaScript if statements — how conditionals use truthy/falsy
- How to convert a string to a number in JavaScript