javascript - This if statement should not detect 0; only null or empty strings -
using javascript, how not detect 0, otherwise detect null or empty strings?
from question title:
if( val === null || val == "" ) i can see forgot = when attempting strict-equality-compare val empty string:
if( val === null || val === "" ) testing firebug:
>>> 0 === null || 0 == "" true >>> 0 === null || 0 === "" false edit: see cms's comment instead explanation.
Comments
Post a Comment