1/**
2* Number.isNaN is almost identical to ES5 global isNaN method.
3* Number.isNaN returns whether the provided value equals NaN.
4* This is a very different question from “is this not a number?”.
5*/
6
7Number.isNaN({}); // <- false, {} is not NaN
8Number.isNaN('ponyfoo') // <- false, 'ponyfoo' is not NaN
9Number.isNaN(NaN) // <- true, NaN is NaN
10Number.isNaN('pony'/'foo') // <- true, 'pony'/'foo' is NaN, NaN is NaN
11
12isNaN({}); // <- true, {} is not a number
13isNaN('ponyfoo'); // <- true, 'ponyfoo' is not a number
14isNaN(NaN); // <- true, NaN is not a number
15isNaN('pony'/'foo'); // <- true, 'pony'/'foo' is NaN, NaN is not a number
1 var s = userInput[0];
2 if(isNaN(s) !== true)
3 {
4 console.log("yes");
5 }
6 else
7 {
8 console.log("no");
9 }
1 var j ="Hello World" // isNaN (j) returns true
2 var n = 15; // isNaN (n) returns false
3
4 if(isNaN(n) == true) // NaN means >> Not a Number
5 {
6 console.log("yes, it's a string");
7 }
8 else
9 {
10 console.log("no, it's a number");
11 }