+ 1
x = 10; console.log(x++); //10 console.log(++x); //12 console.log((x++) + (++x)); //26 console.log((x--) - (--x)); //2
Can any one explain briefly how addition and subtraction work with post and pre. Increment and drecrement in js
2 Answers
+ 2
x = 10;
//first prints then adds:
console.log(x++); //print 10; x=11
//folds first then prints:
console.log(++x); //print 12; x=12
console.log((x++) + (++x)); //26
console.log((x--) - (--x)); //26-24=2
+ 1
Neel Tilak
Use description place to add details, code..
hoping may this helps you.. .
use search bar for more...
https://www.sololearn.com/Discuss/1690694/?ref=app
https://www.sololearn.com/discuss/2238290/?ref=app