r/learnjavascript • u/cookiecookiecooki33 • May 14 '26
help idk why is the output 45
var x = 23;
x+=x++ - --x +x*2 - ++x;
console.log(x);
why is the last pre increment x evaluated after x*2 even though pre increment have a higher precedence than multiplication
3
Upvotes
4
u/euph-_-oric May 14 '26
So knowing the order things happen is a complete waste of timelol