javascript test for nan code example
Example 1: how to check when a number varibal = nan in ts
if (isNaN(number)) {
number = 0;
}
Example 2: isnan in javascript
var s = userInput[0];
if(isNaN(s) !== true)
{
console.log("yes");
}
else
{
console.log("no");
}
Example 3: javascript check if is nan
function isNaN(x) {
return x !== x;
};
isNaN(NaN);//true