0
JS Challenge
I came across this question in JS challenge, var a = 1,x; x = ++a + ++a; x+=a; alert(x); //output is 8 I would be really thankful if anyone explains this to me.
3 Réponses
+ 2
yes.
var a,x;
var a=1,x;
var a,x=1;
all true.
+ 1
x=++a + ++a --> x=++1 + ++(++1)=2+ ++2=2+3=5 and a=3
×+=a // x=x+a=5+3=8
+ 1
I didn't understand the first line var a= 1,x;
Are we assigning two values to one variable a?