I have the following JavaScript/jQuery code:
if (isVariance && value)
tableCell.addClass('NonZeroVariance');
Where:
isVariance
== true
and value
== "0.00"
.
(isVariance && value)
== "0.00"
.
(isVariance && !!value)
== true
.
The if
condition evaluates to true, and the class is added to tableCell
.
So, my expectation was that zero would be interpreted as false, and that "0.00"
would be evaluated as false
. But that's not what happens here. Can someone tell me why?