JavaScript equality transitivity is weird
I've been reading Douglas Crockford's JavaScript: The Good Parts , and I came across this weird example that doesn't make sense to me: '' == '0' // false 0 == '' // true 0 == '0' // true false == undefined // false false == null // false null == undefined // true The author also goes on to mention "to never use == and != . Instead, always use === and !== ". However, he doesn't explain why the above behavior is exhibited? So my question is, why are the above results as they are? Isn't transitivity considered in JavaScript? alex '' == '0' // false The left hand side is an empty string, and the