+ 2

NaN problem in JS

Why the result false a = isNaN(Number("abc")) // return true b = (Number("abc")==NaN) // return false Why a is true and b is false, Number("abc"), return NaN but why b return false. If we make another code like this c = NaN==NaN // return false Will return false, idk whats wrong https://code.sololearn.com/cqmB9liD7YM0/?ref=app

20th Dec 2021, 3:09 PM
Gibran Daffa
Gibran Daffa - avatar
2 Answers
+ 2
Check de MDN doc of NaN https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NaN Theres a section labeled as Testing against NaN.
20th Dec 2021, 3:28 PM
arturop200
arturop200 - avatar
+ 2
Arturop oh ok, thanks for answer my question 😊
20th Dec 2021, 4:06 PM
Gibran Daffa
Gibran Daffa - avatar