Possible Duplicate:
Why is 0 == “” true in JavaScript
The following is done in Firebug:
>>> 0 == ""
true
>>> "" == false
true
But how did the "" get converted to 0? I think the reason they both returned true was that "" gets converted to 0, and in the first case, it becames 0 == 0, and in the second case, first to "" == 0 and then 0 == 0 and so both cases returned true, but how did "" get converted into 0? The Javascript Definitive Guide says the string is converted to a number, but how specifically?