DEV Community

karim coda
karim coda

Posted on

NaN (javascript)

Alt Text

NaN ====> Not_To_Number

Syntax

var val = Number.NaN;

Example
Alt Text

Example from MDN:
Alt Text

Testing against NaN

perform a self-comparison:
NaN and another NaN, will compare unequal to itself.
Alt Text

Using parseInt, parseFloat
It is also NaN when using parseInt, parseFloat.
Alt Text

Top comments (0)