Forum Discussion

CSL's avatar
CSL
Contributor
7 years ago
Solved

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

       }

}

 

  • You can use schDay1 === null 

    = = = evaluate type as well.

2 Replies

  • NisHera's avatar
    NisHera
    Valued Contributor

    You can use schDay1 === null 

    = = = evaluate type as well.

    • CSL's avatar
      CSL
      Contributor

      It does work!!! Thank you so much!