javascript : Object.isNaN([nanValue])
javascript : Object.isNaN([nanValue])
Target:
Applicable with any javascript Object Variable that holds numeric value .
Description :
It checks variable value if it is not a numeric value, NaN or infinity then it return true otherwise false. When nanValue is passed as argument then it convert the value in numeric if it's result is NaN then return nanValue otherwise converted Numeric value.
Note: If nanValue is not passed then it return true/false.
If nanValue is passed then it convert value in numeric and return either Numeric value or nanValue.
another way to check whether variable holds numeric value or Nan or infinity
also convert the string to number if conversion failed then it return argument value nanValue
Syntax:
Object.isNaN([nanValue])
return true/false or converted Numeric/nanValue
Usase:
- var obj = 55;
obj.isNaN()
It return false. - var obj = 55/0;
obj.isNaN()
It return true. - var obj = 'a5.5';
obj.isNaN()
It return true. - var obj = 55;
obj.isNaN(0)
It return 55. - var obj = 55/0;
obj.isNaN(0)
It return 0. - var obj = 'a5.5';
obj.isNaN(0)
It return 0. - var obj = [1,2,3];
obj.isNaN()
It return true. - var obj = [1,2,3];
obj.isNaN(-1)
It return -1.
Download MYJS.js
Comments
Post a Comment