+ 1
Please someone should help me explain the code below cos I don't understand how the result is 9
var X=3 X=++X+X++ alert(X); And the Answer is 9
2 Answers
+ 7
x = 3
x=++x (x was 3, x is now 4) + x++ (x was 4, x is now 5)
4+5=9
note:
the ++x/x++ operation changes the variable it's not the same as x+1
+ 1
Thanks