NaN is the only value in Javascript that is not equal to anything, including itself.
if(NaN !== NaN){
  alert("what??? how???  huh???");
}
Therefore, one way you could check if a variable has the value of NaN is to do something like this:
if(yourVar !== yourVar) { // thanks Vigen Sarksyan for this suggestion
  alert("yourVar has a value of NaN");
}
While this will work, it is not recommended as most people will think you wrote this by mistake and assume there is a bug in your code. The correct way to check if a variable contains a NaN is by calling the isNaN function:
if(isNaN(yourVar)) {
  alert("yourVar has a value of NaN");
}
This is much more readable and produces the same result.

Also note the fact that while NaN stands for “Not a Number”, calling typeof(NaN) returns “number”…so it’s a number that is not a number 🙂