Number.isNaN() In JavaScript

The Number.isNan method in JavaScript is used to determines whether the passed value is NaN(Not a Number) and is of the type “Number”.
In JavaScript, the value NaN is considered a type of number.

Syntax:

`Number.isNaN(value)`

Parameters Used:
1. Value :It is the value which is to be tested for NaN.

Return Value:
The Number.isNaN() method in JavaScript returns true if the passed value is Nan and is of the type number,else it returns false.

Examples:

```Input : 0/0
Output : true

Input : 213
Output : false

Input : '213'
Output : false

Input : 'hello'
Output : false

Input : NaN
Output : true

```
1. When an equation resulting in infinite value is passed as a parameter.

 `<``script` `type``=``"text/javascript"``> ` `    ``var num=0/0; ` `         ``document.write("Output : " + num.isNaN());           ` `      `` `

Output:

`Output : true`
2. When a number is passed as a parameter.

 `<``script` `type``=``"text/javascript"``> ` `    ``var num=213; ` `         ``document.write("Output : " + num.isNaN());           ` `      `` `

Output:

`Output : false`
3. When a number in string representation is passed as a parameter.

 `<``script` `type``=``"text/javascript"``> ` `    ``var test='213'; ` `         ``document.write("Output : " + test.isNaN());           ` `      `` `

Output:

`Output : false`
4. When a string is passed as a parameter.

 `<``script` `type``=``"text/javascript"``> ` `    ``var test='hello'; ` `         ``document.write("Output : " + test.isNaN());           ` `      `` `

Output:

`Output : false`
5. When Nan is passed as a parameter.

 `<``script` `type``=``"text/javascript"``> ` `    ``var check=Nan; ` `         ``document.write("Output : " + check.isNaN());           ` `      `` `

Output:

`Output : true`

My Personal Notes arrow_drop_up

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

Article Tags :

Be the First to upvote.

Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.