+ 1

Output?

var x=NaN; var y=" "; var z=x+y; alert(z+4); //alerts NaN 4 alert(NaN+4); //alerts NaN Why is the 2nd alert showing only NaN while the 1st one shows NaN 4 ?

18th May 2020, 11:26 AM
Kajal Kumari
Kajal Kumari - avatar
1 ответ
+ 6
1st one: NaN + " " + 4 = "NaN " + 4 = "NaN 4" 2nd one: NaN + 4 = NaN
18th May 2020, 2:28 PM
Igor Makarsky
Igor Makarsky - avatar