Skip to main content
Version: 1.3.0

isNaN

Using

This function determines whether the given value is the special NaN value (Not-a-Number).

  • Returns true only if the value is the primitive NaN.
  • Returns false for all other values, including anything that is not strictly the NaN primitive.

Unlike the global isNaN() function, this version avoids type coercion.

Demo - use JSON
isNaN(
)
false

Arguments

ArgumentTypeDescriptionExample
valueunknownCan be any type"text"
2
undefined

Returns

booleantrue if value is primitive NaN, false otherwise

Examples

isNaN(NaN);
// true

isNaN(0 / 0);
// true

isNaN(Number('abc'));
// true

isNaN('NaN');
// false

isNaN(42);
// false

isNaN(new Number(NaN));
// false

isNaN(() => NaN);
// false

Resources

📦 Since:1.3.0
📦 Last updated:1.3.0
📦 Available in:1.3.0