JAVASCRIPT CHALLENGE QUESTION | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

JAVASCRIPT CHALLENGE QUESTION

Please why is the output of this code true? var x= Boolean(NaN===NaN) var y= Boolean(NaN===NaN) if(!x) alert(x===y) else alert(y)

9th Nov 2019, 12:40 PM
Valentine
Valentine  - avatar
1 Answer
+ 4
NaN means Not a Number.(can be anything but not a number) and cannot determined exactly. Then x = false y = false !x is true x===y =>false===false =>true
9th Nov 2019, 1:07 PM
Jayakrishna 🇮🇳