# isNaN function

The `isNaN` function checks if a passed parameter is a number or not. It returns `true` if the parameter is not a number and `false` if it is. How it works: the passed parameter is converted to a number. If it is not a number (string, array, etc.), then it is converted to `NaN`. Well, and `isNaN` checks whether we got `NaN` after conversion or not. But `true` is converted not to `NaN`, but to the number `1`. There are other similar pitfalls, see them in the `NaN` description.

## Syntax

`isNaN(value);`

## Example

Now `isNaN` will return `false` since the parameter is a number:

`console.log(isNaN(3));`

The code execution result:

`false`

## Example

Now `isNaN` will return `true` since the parameter is not a number:

`console.log(isNaN('abcde'));`

The code execution result:

`true`

## See also

- the `isFinite` function
  that checks a number for finiteness
- the `typeof` operator
  that defines a data type

← →
↑
en ru