JavaScript · Junior · Question 66 of 75
How does Number.isNaN("abc") differ from isNaN("abc")?
- ✓Correct answer:
Number.isNaNgivesfalse(it's a string, not NaN); globalisNaNconverts first and givestrue - 2Both return
true - 3Both return
false
Explanation
The global isNaN coerces its argument, which leads to surprises. Number.isNaN checks only for the actual NaN value.