# NaN

Vullnetarët tanë s’e kanë përkthyer ende në Shqip këtë artikull. Merrni pjesë dhe ndihmoni të mbarohet kjo punë!
Mund ta lexoni artikullin edhe në English (US).

The global `NaN` property is a value representing Not-A-Number.

Property attributes of `NaN`
Writable no
Enumerable no
Configurable no

## Description

`NaN` is a property of the global object.

The initial value of `NaN` is Not-A-Number — the same as the value of `Number.NaN`. In modern browsers, `NaN` is a non-configurable, non-writable property. Even when this is not the case, avoid overriding it.

It is rather rare to use `NaN` in a program. It is the returned value when `Math` functions fail (`Math.sqrt(-1)`) or when a function trying to parse a number fails (`parseInt("blabla")`).

### Testing against `NaN`

`NaN` compares unequal (via `==`, `!=`, `===`, and `!==`) to any other value -- including to another NaN value. Use `Number.isNaN()` or `isNaN()` to most clearly determine whether a value is NaN. Or perform a self-comparison: NaN, and only NaN, will compare unequal to itself.

```NaN === NaN;        // false
Number.NaN === NaN; // false
isNaN(NaN);         // true
isNaN(Number.NaN);  // true

function valueIsNaN(v) { return v !== v; }
valueIsNaN(1);          // false
valueIsNaN(NaN);        // true
valueIsNaN(Number.NaN); // true
```

However, do note the difference between `isNaN()` and `Number.isNaN():` the former will return `true` if the value is currently `NaN`, or if it is going to be `NaN` after it is coerced to a number, while the latter will return `true` only if the value is currently `NaN:`

```isNaN('hello world');        // true
Number.isNaN('hello world'); // false
```

## Specifications

Specification Status Comment
ECMAScript Latest Draft (ECMA-262)
The definition of 'NaN' in that specification.
Draft
ECMAScript 2015 (6th Edition, ECMA-262)
The definition of 'NaN' in that specification.
Standard
ECMAScript 5.1 (ECMA-262)
The definition of 'NaN' in that specification.
Standard
ECMAScript 1st Edition (ECMA-262) Standard Initial definition. Implemented in JavaScript 1.3

## Browser compatibility

Update compatibility data on GitHub
Desktop Mobile Server Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Edge Mobile Firefox for Android Opera for Android Chrome Full support Yes Edge Full support Yes Firefox Full support 1 IE Full support Yes Opera Full support Yes Safari Full support Yes WebView Android Full support Yes Chrome Android Full support Yes Edge Mobile Full support Yes Firefox Android Full support 4 Opera Android Full support Yes Safari iOS Full support Yes Samsung Internet Android Full support Yes nodejs Full support Yes

Full support
Full support