+ 2
Could you explain the result of this expression in JS?
Please explain the result of the following expression: 'b' + 'a' + + 'a' + 'a' Result: 'baNaNa'
2 ответов
+ 6
😂
'b' + 'a' == ba
++ 'a' == NaN
+ 'a' == a
=> baNaNa
😂
//should be like this
var a,b,c;
a = "b"+"a";
b = +"a";
c="a"
document.write(a+b+c)
+ 1
the first b and a are strings so they concatenate to 'ba'. you have an empty space + a which gives NaN + your a string at the end.