← TechnologyThe essentials of

Number.isNaN(): check NaN without hidden conversion

Publisher: ResumeMaker • 1 source

Published: 22 Oct 2026 13:13 · Updated: 22 Oct 2026 13:13

AI source check: 21 Oct 2026 10:06. This is not editorial approval.

In a few sentences

In brief

Number.isNaN() checks whether the value is actually the numerical NaN. Plain text is not automatically converted to a number.

Useful to know

Number.isNaN() returns true only when the value submitted is the number NaN. For non-numeric values, returns false. This distinguishes it from the global function isNaN(), which can first convert the input. [1]

For example, Number.isNaN(Number('apple')) is true, because the conversion to a number failed. But Number.isNaN('apple') is false: the argument is text, not the number NaN. The two checks answer different questions.

When processing a field from a form, separate the steps: get the text, check if it is empty, convert it to a selected rule, and check the result. Do not assume that Number.isNaN() checks itself whether each input is an acceptable price or quantity.

There are other unacceptable numerical values according to the task: negative quantity, too large a number or infinity. They are not necessarily NaN. The business rule validation must indicate the permissible range separately.

Sources

For further detail and to check the information:

  1. [1] MDN — Number.isNaN ↗