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

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -