0

I was just trying something in javascript and came across this scenario for the javascript equality operator, which baffled me

enter image description here

My questions are,

1) Why ""==0 is true ?

2) If "0"==0 and ""==0 is true then why ""=="0" is false ?

Any explanation and the pointers for more reading will be great.

user2745246
  • 304
  • 1
  • 3
  • 14
  • 3
    Like this: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Operators/Comparison_Operators – Jonathan Jul 27 '15 at 16:52
  • I'm really surprised the title box didn't pop up ten different duplicates when you posted this question. – George Stocker Jul 27 '15 at 16:57
  • Probably the best read on the topic of loose vs. strict equality & type coercion - [here.](https://github.com/getify/You-Dont-Know-JS/blob/master/types%20&%20grammar/ch4.md) – rgbchris Jul 27 '15 at 16:58

0 Answers0