Ask a Question

how to handle 0 and null value in java script

SOLVED
CSL
Contributor

how to handle 0 and null value in java script

Hello,

 

I am having some issues handling 0 and null values in javascript. I want them to be handled differently, 0 is always handled the same as null. The code below returns True.

 

ex.

 

function main()

{

schDay1 = 0

if ((schDay1 == null) || (schDay1 =="" ))

    //Set it to next day

    schDay = 1;

else

      {

       schDay = schDay1

       }

}

 

2 REPLIES 2
NisHera
Valued Contributor

You can use schDay1 === null 

= = = evaluate type as well.

It does work!!! Thank you so much!

cancel
Showing results for 
Search instead for 
Did you mean: