Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

One of the strangest things about == is that although it's commutative, it's not transitive:

  0 == '0'  // true
  0 == ''   // true
  '0' == '' // false


Is it really that strange?

Those statements are basically (as per ECMA-262 11.9.3):

0 === Number('0') 0 === Number('') '0' === ''




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: