Check for NaN, null and >=0 in one condition

后端 未结 7 1861
一个人的身影
一个人的身影 2021-02-15 14:32

I have a var a;

Its value can be NaN, null and any +ve/-ve number including 0.

I require a condition which filters out all the values of a such that

7条回答
  •  别那么骄傲
    2021-02-15 14:55

    My best solution to filter those values out would be with 2 condition and it is like;

     if(a!=undefined && a>=0){
          console.log('My variable is filtered out.')
        }
    

    I am not sure but there is no single condition usage to make it.

提交回复
热议问题