So NaN itself will return the property of NaN, which is what you would expect. What would you expect the typeof(NaN) to be?
Remember how I said NaN isn't as simple as it seems? The type of NaN is actually a number which is really strange given it's name. NaN is mainly used to define a number that isn't a number, that doesn't really make sense but lets look at an example.
You can see here that the string "1" is converted into a number whereas "hello" cannot be converted into a number so the result is NaN.
This even happens when you compare NaN against NaN. Which can often be really confusing as you would expect NaN == NaN to be true. NaN != NaN, remember I did say NaN is a bit odd.
So what do you do if you want to check if something is not a number?
These examples return exactly what we would expect, for the isNaN("100") the string "100" is being implicitly coerced into the number 100, so we are essentially doing isNaN(100). Let's try this again with a string that cannot be coerced into a number.
So when we call isNaN("hello") what is actually happening is
So how do we check for NaN?
Here we are checking that the variable notANumber does not equal itself, so as NaN == NaN returns false we can check that NaN !== NaN and the return value will be true, it's not a number.
aNumber is a number so asking if it does not equal itself will return false.
So anything that compares against itself using the !== operator will return false expect NaN which will return true.
So because of the quirk that NaN does not equal NaN we can determine if something is NaN using !==, as unless it is NaN it will return false.