Now this is a helpful explanation. Thank you!

Operator precedence doesn't mean "evaluates before everything else",
it means "in case of doubt, follow specified order".

Let's say you have the expression without parenthesis "A = B || C".
There's a doubt as long as we don't know the precedence order between
= and ||.

Now "(A = B) || C". Since we know that () takes precedence over ||, we
know that the expression is a || with two sides, A = B and C.

And "A = (B || C)". Since we know that () takes precedence over =, we
know that the expression is a = with left-hand A and right-hand B ||
C.

Now "A || B = C". Let's say we don't know the precedence between ||
and =. Putting parenthesis "A || (B = C)", we know that we have a ||
with two sides, A and B = C. But || is still evaluated from left to
right! On the contrary, (A || B) = C is invalid (wrong lef-hand side
for assignment operator).

Simply put, precedence has nothing to do with order of evaluation.

--
To view archived discussions from the original JSMentors Mailman list: 
http://www.mail-archive.com/[email protected]/

To search via a non-Google archive, visit here: 
http://www.mail-archive.com/[email protected]/

To unsubscribe from this group, send email to
[email protected]

Reply via email to