Unquoted literal constant NaN is a special value representing Not-a-Number. Since NaN always compares unequal to any number, including NaN, it is usually used to indicate an error condition for a function that should return a valid number.
Note − Use the isNaN() global function to see if a value is an NaN value.
The syntax to use NaN is −
var val = Number.NaN;
Try the following example to learn how to use NaN.