0

Why, in Javascript,

0 == ''

is true ?

http://jsfiddle.net/TXhCs/

Marco S.
  • 137
  • 8

1 Answers1

0

That is because javascript is attempting to do a type conversion on '' since '' is a type String and 0 is a number type. '', when converted to a number, is 0

What have you tried
  • 11,018
  • 4
  • 31
  • 45
  • 2
    there is no conversion to a `Boolean` here. The _result_ of the `==` operation is a boolean, though. – Alnitak Mar 28 '13 at 16:54
  • Yeah sorry I realized that was incorrect after I wrote it. Thanks for the tip, I edited my response - doesn't matter since the question is closed now anyways. – What have you tried Mar 28 '13 at 16:57