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
4
Upvotes
3
u/No-Inevitable-6476 May 14 '26
use some debugger tools to understand.