Member-only story
Everything you need to know about NaN in JavaScript
Also, why you should STOP using isNaN and what to use instead

NaN
is a global property that represents the value of Not-A-Number, hence the name. It is possible to get the value NaN
returned when doing an arithmetic operation or coercing some value to a number. Here are some operations that result in NaN

it is worth mentioning that most of the confusion about NaN
comes from the behavior of coercing a non-numeric-value to a numeric-value which results in NaN
. For this reason, I recommend getting yourself familiarized with the last few examples from the code above and better yet why some values such as booleans, [1]
and ‘’
do not result in NaN
Interesting facts about NaN
NaN
has a bad reputation for being tricky, however, if you familiarize yourself with the following few facts you will be able to work with NaN
with no issue.
NaN
unlike it's name is actually from the type Number
typeof NaN; // 'number'
NaN
has a falsy value
Boolean(NaN); // false