Recently, i fell into the trap of NaN and isNaN and it turned me pulling my hair for quite a few good minutes. Thats why i decided to make a note of it here for a recitation and as a note of reference for myself for future.
var x = parseInt("Hello"); //this would label your variable x as NaN.
Now suppose you wanted to check whether x is NaN or not. Having not looked at the isNaN and/or NaN earlier carefully (like me) you may simply fell into this trap and may try to compare x with NaN like this:
if(x==NaN) - incorrect if(x=="NaN") - incorrect
Always use isNaN to compare NaN value.
if(isNaN(x)) - correct, works!