0

What's the difference between ++a and a++. When to use them?

13th Sep 2016, 11:07 AM
Shashidhar D
Shashidhar D - avatar
3 Answers
+ 4
a better answer to this is that x=a++ assigns the value of a to x and then increment a of one. Doing x=++a will first increment a and then assign the value of a to x.
30th Sep 2016, 10:39 PM
Dennis JoĂŁo Avanci
Dennis JoĂŁo Avanci - avatar
0
++a will give you new data a++ will give you old data eg. a=2; then z=a++; document.write(z); then output is 2 if z=++a; document.write(z); then output is 3
20th Sep 2016, 7:09 PM
Nitin kumar
Nitin kumar - avatar
0
ok
7th Oct 2016, 4:46 AM
Ezequiel Cardoso
Ezequiel Cardoso - avatar