Operator Precedence

Hey guys,
somebody can explain me simply “Operator precedence”? i checked the MDN Docs but dont’ really get it…

Thanks in advance for the help

I’m guessing that you’ve googled this and read a few results. Can you tell us what parts of the explanations don’t make sense?

i dont’ really understand the meaning of " highest (20) to lowest (1) precedence"

@yannis182 – the highest(20) to lowest(1) thing is an arbitrary system. Do you have an understanding of the order of operations in basic math, or algebra?

Operator Precedence is kind of like the PEMDAS anagram we use to understand our order of operations in math. However with programming there is a bit more going on as they describe a logical flow of operations.

What the MDN page describe is that the logical flow of operators can move in various directions however the precedence of an operator determines how soon it acts before others. Operators of a left to right flow be chained together on values.

1 + 2 + 3 * 4 / 10

or they can affect values on their left.

let a = 0;
a; // 1
1 Like

Yes now i got it! thank you

Thank you for the answer now it make sense!