+ 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

17th Jan 2022, 3:02 PM
Neel Tilak
Neel Tilak - avatar
2 odpowiedzi
+ 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
17th Jan 2022, 5:57 PM
Solo
Solo - avatar
+ 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
17th Jan 2022, 3:05 PM
Jayakrishna 🇮🇳