# Javascript - Global isNaN() Function

The isNaN() function determines whether a value is an illegal number (Not-a-Number).

## Description

The isNaN() function determines whether a value is an illegal number (Not-a-Number).

This function returns true if the value equates to NaN. Otherwise it returns false.

The global isNaN() function converts the tested value to a Number, then tests it.

Number.isNaN() does not convert the values to a Number, and returns false for non-number type.

## Syntax

```isNaN(value)
```

## Parameter Values

Parameter Require Description
value Required. The value to be tested

## Return

A Boolean. Returns true if the value is NaN, otherwise it returns false

## Example

Check whether a value is NaN:

## Demo

```var res = "";
res = res + isNaN(123) + ": 123\n";
res = res + isNaN(-1.23) + ": -1.23\n";
res = res + isNaN(5-2) + ": 5-2\n";
res = res + isNaN(0) + ": 0\n";
res = res + isNaN('123') + ": '123'\n";
res = res + isNaN('Hello') + ": 'Hello'\n";
res = res + isNaN('2015/12/12') + ": '2015/12/12'\n";
res = res + isNaN('') + ": ''\n";
res = res + isNaN(null) + ": null\n";
res = res + isNaN(true) + ": true\n";
res = res + isNaN(undefined) + ": undefined\n";
res = res + isNaN('NaN') + ": 'NaN'\n";
res = res + isNaN(NaN) + ": NaN\n";
res = res + isNaN(0 / 0) + ": 0 / 0\n";

console.log(res);//from  w  ww  .  j  a  v  a 2  s.  c  o m
```