0

What is ++a or --a ?

31st Dec 2016, 9:23 AM
Nicu
5 Respuestas
+ 4
The same as a++ or a--, but the increment happens immediately, instead of after the statement. var x = 1; document.write(x++); // the output would be 1 // now x is 2 document.write(++x); // the output would be 3
31st Dec 2016, 9:32 AM
Dao
Dao - avatar
+ 2
As I already explain the different position determines when it happens, not what happens.
31st Dec 2016, 10:57 AM
Dao
Dao - avatar
0
simply saying pre increment and post increment works similarly but.... ++a does addsn and --a does subsn by one. it first increment / decrements then executes.
31st Dec 2016, 10:34 AM
hariom kr sinha
hariom kr sinha - avatar
0
So is la a++ or a--
31st Dec 2016, 10:54 AM
Nicu