← back to flaviocopes.com

JS equality explorer

← All tools

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

OperatorResult
A == B
A === B
Object.is(A, B)

Truthiness

ValueTruthy?
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