# Number.isNaN()

O método `Number.isNaN()` determina se o valor passado é `NaN` (en-US). Esta é uma versão mais robusta que `isNaN()` (en-US).

## Sintaxe

``Number.isNaN(valor)``

### Parâmetros

`valor`
O valor a ser testado se é `NaN` (en-US).

## Descrição

Due to both equality operators, `==` (en-US) and `===` (en-US), evaluating to `false` when checking if `NaN` (en-US) is `NaN` (en-US), the function `Number.isNaN()` has become necessary. This situation is unlike all other possible value comparisons in JavaScript.

In comparison to the global `isNaN()` (en-US) function, `Number.isNaN()` doesn't suffer the problem of forcefully converting the parameter to a number. This means it is now safe to pass values that would normally convert to `NaN` (en-US), but aren't actually the same value as `NaN` (en-US). This also means that only values of the type number, that are also `NaN` (en-US), return `true`.

## Exemplos

``````Number.isNaN(NaN);        // true
Number.isNaN(Number.NaN); // true
Number.isNaN(0 / 0)       // true

// e.g. these would have been true with global isNaN()
Number.isNaN("NaN");      // false
Number.isNaN(undefined);  // false
Number.isNaN({});         // false
Number.isNaN("blabla");   // false

// These all return false
Number.isNaN(true);
Number.isNaN(null);
Number.isNaN(37);
Number.isNaN("37");
Number.isNaN("37.37");
Number.isNaN("");
Number.isNaN(" ");
``````

## Polyfill

``````Number.isNaN = Number.isNaN || function(value) {
return typeof value === "number" && isNaN(value);
}``````