JS Coding Questions Logo
JS Coding Questions
#423💼 Interview💻 Code

What is the difference between isNaN and Number.isNaN?

Advertisement

728x90

1. isNaN: The global function isNaN converts the argument to a Number and returns true if the resulting value is NaN.

2. Number.isNaN: This method does not convert the argument. But it returns true when the type is a Number and value is NaN.

Let's see the difference with an example,

javascript
1isNaN(‘hello’);   // true
2
3Number.isNaN('hello'); // false

Advertisement

Responsive Ad
🎯 Practice NowRelated Challenge

JavaScript Coding Exercise 80

Test your knowledge with this interactive coding challenge.

Start Coding

Advertisement

728x90
423of476
What is the difference between isNaN and Number.isNaN? | JSCodingQuestions.com