+ 11
How the answer will come 8?
I am not getting,how to solve this? var a=1,x; x=++a + ++a; x +=a; alert(x); Plz explain
2 Answers
+ 11
first time,
line 1 ,a=1
line 2 ,x=++a+ ++a (here first time a=2 and second time a=3 ) so x=2+3 =5
line 3 x+=a (a=3 now and x=5 before .So in this line x=5+3 =8
so the value of x is 8
+ 4
Alphin K Sajan
This question is from challenges ,so i dont think it should be worngđ€