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 only >=0 values yield a true in if condition.
What is the best possible way to achieve this, I do not wish to use 3 different conditions joined using ||
1. isNaN() Method: To determine whether a number is NaN, we can use the isNaN() function. It is a boolean function that returns true if a number is NaN otherwise returns false.
Within pandas, a missing value is denoted by NaN . In most cases, the terms missing and null are interchangeable, but to abide by the standards of pandas, we'll continue using missing throughout this tutorial.
NaN values are generated when arithmetic operations result in undefined or unrepresentable values.
The math. isnan() method checks whether a value is NaN (Not a Number), or not. This method returns True if the specified value is a NaN, otherwise it returns False.
Ohk ...But i actually found the ans .. it is so Simple .
parseInt(null) = NaN.
So if(parseInt(a)>=0){}
would do ...Yayyee
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With