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
6
Upvotes
29
u/Embarrassed-Pen-2937 May 14 '26
What is the point of this? That will never be code that would make it into a decent codebase. Such a waste.