CodeNewbie Community


What's the difference between double equals (==) and triple equals (===) in JavaScript?

A wanna-be writer turned wanna-be developer.
・1 min read

Hey guys, Shane here. I'm trying to wrap my head around the issue of double equals (==) vs. triple equals (===) in JavaScript - can anyone help me figure out how they're different?

Discussion (3)

murkrage profile image
Mike Ekkel

Hey Shane! So in their core they do the same: check equality (does left equal right). However, the way they do so differs.

The double equals (==) is an abstract equality check. What this means is that either value’s type can be converted to another type during comparison. So 0 == ‘0’ evaluates to true.

The triple equals (===) is a strict equality check. What this means is that it requires both values to be of the same type. So 0 == ‘0’ evaluates to false because type number is not the same as type string.

Check out this MDN page for more information:

thegnshane profile image
Shane Author

You da man! Thanks!

aaron profile image
Aaron McCollum

Mike hit the nail on the head!