Skip to content

isNaN

The isNaN function checks if a value is NaN (Not-a-Number).

Syntax

typescript
isNaN(value)

Parameters

NameTypeDescription
valueanyValue to be checked.

Return Value

TypeDescription
booleantrue if the value is NaN, else false.

Examples

typescript
isNaN(NaN);      // true
isNaN(10);       // false
isNaN('text');   // false

Notes

  • Useful for mathematical validations and error control.
  • This function strictly checks if the value is NaN, not if it can be converted to NaN.

References

Released under the MIT License.