3 ms·
One of the strangest things about == is that although it's commutative, it's not transitive: 0 == '0' // true 0 == '' // true '0' == '' // false
by spicyj 15y ago
One of the strangest things about == is that although it's commutative, it's not transitive:
0 == '0' // true
0 == '' // true
'0' == '' // false
- jaysoo 15y agoIs it really that strange? Those statements are basically (as per ECMA-262 11.9.3): 0 === Number('0') 0 === Number('') '0' === ''