On this page
Global.Number_isNaN
Prev: structuredClone | Up: Global | Next: parseInt
Rel: Global, JS Core Syntax & Types
Ref: MDN Web Docs — Global.Number_isNaN
Tags: #public #web #javascript #builtins #global #tier/core
Signature & Overview
Number.isNaN(value)
Returns true only if value is literally the NaN number (no type coercion).
Notes & Pitfalls
- Does NOT coerce strings to numbers:
Number.isNaN("hello")isfalse, whereas globalisNaN("hello")returnstrue—always preferNumber.isNaN().
Example
console.assert(Number.isNaN(NaN) === true);
console.assert(Number.isNaN("hello") === false);
console.assert(Number.isNaN(undefined) === false);
Linked from
Related notes
- tuts/javascript/builtins/Global/parseInt Linked here; links to this page; shared tags: #builtins, #global, #javascript, #tier, #web
- tuts/javascript/builtins/Global/structuredClone Linked here; links to this page; shared tags: #builtins, #global, #javascript, #tier, #web
- tuts/javascript/builtins/Global Linked here; links to this page; shared tags: #builtins, #global, #javascript, #web
- tuts/javascript/builtins/Global/isNaN links to this page; shared tags: #builtins, #global, #javascript, #tier, #web
- tuts/javascript/tutorials/core_syntax_and_types Linked here; shared tags: #javascript, #web
- tuts/javascript/builtins/Global/encodeURIComponent shared tags: #builtins, #global, #javascript, #tier, #web
- tuts/javascript/builtins/Global/globalThis shared tags: #builtins, #global, #javascript, #tier, #web
- tuts/javascript/builtins/Global/queueMicrotask shared tags: #builtins, #global, #javascript, #tier, #web
- tuts/javascript/builtins/Array/at shared tags: #builtins, #javascript, #tier, #web
- tuts/javascript/builtins/Array/filter shared tags: #builtins, #javascript, #tier, #web