The == Operator Lacks Transitivity in JavaScript

In mathematics “is equal to”, equality is a transitive relation meaning that

if a = b and b = c, then a = c

Be aware that the == operator lacks transitivity in JavaScript.

Consider the following example where a = '0', b = 0 and c = ''

Don’t use the == operator, use the === operator for equality instead.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store