Number.isNaN() is a static method on Number (same API as MDN Number.isNaN). Call Number.isNaN(value) — not on a number instance. It returns true only for the number value NaN. This tutorial covers syntax, why === fails, the difference from global isNaN(), five examples, and try-it labs.
01
Call on
Number only
02
Returns
boolean
03
True when
Number NaN
04
False for
Non-numbers
05
Coercion
None
06
Baseline
Everywhere
Fundamentals
Introduction
Failed math and bad parses often produce NaN (“Not a Number”). You cannot detect it with x === NaN, because NaN is not equal to itself.
Number.isNaN() is the reliable, modern check. Unlike the older global isNaN(), it does not coerce strings first — so Number.isNaN("NaN") is false.
💡
Static Method
Static methods belong to Number itself. Always write Number.isNaN(x). There is no (5).isNaN() on Number.prototype.
Number.NaN and the global NaN identifier refer to the same IEEE-754 NaN value.
Applications
🚀 Common Use Cases
Guard after parse — Number.isNaN(Number(raw)) before using form input.
Failed math — catch 0 / 0 and other indeterminate results.
API validation — reject NaN before JSON or database writes.
Replace === NaN — the only reliable equality-style check for NaN.
Safer than global isNaN — avoid treating strings/objects as NaN by accident.
Pair with isFinite — finite + not NaN is already covered by Number.isFinite.
🧠 How Number.isNaN() Decides
1
Receive value
Any JavaScript value can be passed in.
Input
2
Check type
Must be typeof number — no coercion.
Type
3
Detect NaN
Same idea as testing x !== x.
Filter
4
✅
Return boolean
true only for the number NaN.
Important
📝 Notes
This is a static method — use Number.isNaN(x) only.
Does not coerce strings, objects, undefined, or booleans.
NaN === NaN is always false — never use === to find NaN.
Global isNaN is older and coercing — prefer the Number static method in new code.
Number.isNaN(Infinity) is false — use Number.isFinite() for infinity checks.
Among all JS values, only NaN satisfies x !== x.
Compatibility
Browser & Runtime Support
Number.isNaN() is Baseline Widely available — part of ES2015 and supported in every modern browser and Node.js.
✓ Baseline · Widely available
Number.isNaN()
Safe for production everywhere. Prefer it over global isNaN() for type-safe NaN detection.
100%Universal support
Google ChromeSupported · Desktop & Mobile
Full support
Mozilla FirefoxSupported · Desktop & Mobile
Full support
Apple SafariSupported · macOS & iOS
Full support
Microsoft EdgeSupported · Chromium
Full support
Internet ExplorerNo native support · Use a polyfill
Polyfill
OperaSupported · Modern versions
Full support
Samsung InternetSupported · Android
Full support
BunSupported · JavaScript runtime
Supported
DenoSupported · JavaScript runtime
Supported
Node.jsSupported · Server runtime
Supported
Android WebViewSupported · Modern WebView
Full support
Number.isNaN()Excellent
Bottom line: Use Number.isNaN for new code. Parse strings yourself before checking if text input must become a number first.
Wrap Up
Conclusion
Number.isNaN() is the modern, static way to detect the number value NaN — without the coercion surprises of global isNaN(), and without relying on broken === comparisons.
Combine with finite/integer checks when validating inputs
❌ Don’t
Write (5).isNaN() — that is not a Number method
Assume the string "NaN" passes the check
Use === NaN for detection
Confuse NaN with Infinity
Rely on global isNaN(undefined) being true
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about Number.isNaN()
Static, strict, boolean check for the number NaN.
5
Core concepts
🔢01
Kind
static
API
✅02
Returns
boolean
Result
≠03
Equality
NaN≠NaN
Quirk
Aa04
Coercion
none
Strict
⚡05
Safe
Baseline
Support
❓ Frequently Asked Questions
Number.isNaN(value) returns true only when value is of type number and is NaN. Example: Number.isNaN(NaN) is true; Number.isNaN("NaN") is false.
Yes. Call it on Number itself: Number.isNaN(x). Do not call it on a number instance like (5).isNaN() — that is not the Number API.
Global isNaN() coerces the argument to a number first, so isNaN("NaN") and isNaN(undefined) are true. Number.isNaN() never coerces — non-numbers always return false.
In JavaScript, NaN is the only value that is not equal to itself. NaN === NaN is false. Use Number.isNaN(x) (or the less readable x !== x) instead.
Yes. 0 / 0 evaluates to NaN, and that value is a number, so Number.isNaN(0 / 0) is true.
It is Baseline Widely available (ES2015) and supported in every modern browser and Node.js.
Did you know?
Among all possible JavaScript values, only NaN makes x !== x evaluate to true. That is why Number.isNaN(x) can be thought of as a readable wrapper around that test.