+ 2

What is the right answer

var x = 1; var y = "Hello"; x = Math.pow(y,2); y = x; if (x==y){ alert ("true"); } else { alert ("false"); }

16th Aug 2019, 5:35 AM
Safaa Alnabhan
Safaa Alnabhan - avatar
3 Antworten
+ 5
anonymous is correct except that x becomes NaN after trying to use Math.pow() on string. https://code.sololearn.com/WsbXTyy2V62j/?ref=app for comparing NaN, we use isNaN() or Number.isNaN() https://www.sololearn.com/post/133451/?ref=app https://www.sololearn.com/post/133947/?ref=app
16th Aug 2019, 6:17 AM
Gordon
Gordon - avatar
+ 2
False
16th Aug 2019, 5:49 AM
Paul Grasser
Paul Grasser - avatar