As far as I know in JavaScript !! is supposed to normalize a boolean value converting it to true or false from some other type. This would mean that the \"0\" converts to bo
In the first case, a non-empty string is equivalent to true.
In the second case, because one operand is a boolean, both operands are converted to numeric values. I believe false
converts to the numeric value 0
and the string "0"
also converts to a numeric 0
, resulting in 0 == 0
which is true.
Check out the Mozilla reference for operator behavior.