+ and PP in javascript

recently I am very interested in this code

var y = 1;
var i =1;
var t = y+yPP+y+yPP;
i +=iPP+iPP+i;

is a little confused about the above code. The pre-PP and unary addition in the operator priority are at the same level, but the post-PP priority is higher, and the addition + and assignment + = priority is the lowest. As a result, the above t runs one by one from left to back. I wonder if there is a + in which the code runs from left to right, and then when it encounters PP, it counts first, and then calculates +. The precedence of the js operator precedence PP is in the order from right to left, and the post PP is a PP. I don"t know what it means, and I forgot to point it out. I don"t know if I understand it right. I look forward to God"s advice or two. Thank you very much, a rookie who wants to learn from js.

Mar.22,2021

this kind of question actually does not have much meaning, usually write should pay attention to do not use.
add parentheses to avoid ambiguity when you are really uncertain.


var y = 1;
var i =1;
var t = y+(yPP)+y+(yPP);    // 1+1+2+2
i += (iPP)+(iPP)+i;    // 1+1+2+3

you have to understand that y + + y is not valid, so in the order from left to right, if there is no accident, it is generally interpreted as yPP + y

.
Menu