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

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

PostgreSQL 9.x - pg_read_binary_file & inserting files into bytea -

asp.net - call stack missing info on mono with apache and mod_mono -