NaN in JavaScript is paradoxically a number type that represents non-numeric calculation results. It propagates through arithmetic operations, always returning NaN, and uniquely isn't equal to itself (NaN !== NaN). This behavior stems from IEEE floating-point standards where NaN acts as an error state. Two methods exist for checking NaN: the global isNaN() coerces values before checking, while Number.isNaN() checks for explicit NaN values without coercion. Understanding this distinction is crucial for proper type validation in calculations.

8m read timeFrom piccalil.li
Post cover image
Table of contents
Try it outTry it outTry it outTry it outTry it outTry it out

Sort: