I'll just add something here which makes it somewhat clear for me.
For my purposes there's a distinction between 'not a number' and Nan.
console.log(isNaN("StackOverflow")); => true as it ONLY checks if the value is 'not a number'
console.log(isNaN("3")); => false as isNaN does a conversion before checking if the input is 'not a number'
If a = NaN and b = Number.NaN.
All a are b, but not all b are a.
We would only get Number.IsNaN() = true (as all a are b we will also have IsNan() = true for these cases) in specific cases:
- Where a conversion fails: parseInt("a");
- Where we perform a mathematical operation which does not return a real number: Math.sqrt(-1);
- Indeterminite form (0 * Infinity)
- Where we use Nan as an operand: 7 * NaN (NaN is contageous!)
- Where we want to represent an invalid value as a number: new Date("a").getTime();