One of the strangest things about == is that although it's commutative, it's not transitive:
0 == '0' // true
0 == '' // true
'0' == '' // false 0 == '0' // true
0 == '' // true
'0' == '' // falseThose statements are basically (as per ECMA-262 11.9.3):
0 === Number('0') 0 === Number('') '0' === ''