# NaN - It's Not A Number🙄

According to [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NaN), 

> NaN is a property of the global object. In other words, it is a variable in global scope.

> 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.

Hear the value of NaN is Number.NaN. But, wait!

```javascript
NaN === Number.NaN // false
```

Maybe because of the type you think🤔

```javascript
NaN == Number.NaN // false
```

Somewhat reasonable explanation started [here](https://en.wikipedia.org/wiki/NaN#Comparison_with_NaN) when I followed the links.

With a lot of confusion around NaN, let us see how we could arrive at a value of NaN.
There are 5 different operations which could result in NaN.
+ Numbers that can't be parsed
```javascript
parseInt('Integer') ⇒ NaN
Number('%^@#') ⇒ NaN
```

+ Math operation where the result is not a real number
```javascript
Math.sqrt(-1); ⇒ NaN
```

+ The operand of an argument is NaN
```javascript
NaN + 20 ⇒ NaN
60 * NaN ⇒ NaN
```

+ Indeterminate form
```javascript
0 * Infinity ⇒ NaN
```

+ Any operation that involves a string and is not an addition operation
```javascript
"Integer" * 5 ⇒ NaN
```

For geekier discussions, reach out to me on twitter at [@radnerus93](https://twitter.com/radnerus93), 📥 DM always open.
