0

Why the answer is False ?

var x= NaN; var y= x; if(y===x){ console.log(True); else console.log(False);

20th Jan 2022, 12:45 PM
Mohammed
2 ответов
+ 3
In terms of accepting NaN == NaN, something which is not a number is not necessarily equivalent to something else which also isn't a number. NaN is non-deterministic value, it has no literal value. So it's comparison of not something == not something is also not something. https://www.sololearn.com/discuss/1772843/?ref=app https://www.sololearn.com/discuss/1940153/?ref=app https://www.sololearn.com/discuss/1747008/?ref=app https://www.sololearn.com/discuss/1684244/?ref=app https://www.sololearn.com/discuss/1201484/?ref=app
20th Jan 2022, 1:16 PM
Jayakrishna 🇮🇳
+ 2
Seems it's a historical mistake that is difficult to change. https://stackoverflow.com/questions/10034149/why-is-nan-not-equal-to-nan/10059796#10059796
20th Jan 2022, 1:11 PM
FanYu
FanYu - avatar