Consider the following javascript snippets:
let x = 0;
x += 1;
and
let x = 0;
x = x + 1;
Is there any meaningful differences between these two snippets? The reason I ask is because the first example prevents Chrome from optimizing the function containing it, while the second example doesn't. This benchmark illustrates the performance differences over many iterations.
As for my original question, I wonder if there is any semantic difference because if there isn't, I would like to know why Chrome wouldn't just de-sugar the compound assignment to the x = x + 1
form.