In JavaScript and Java, the equals operator (==
or ===
) has a higher precedence than the OR operator (||
). Yet both languages (JS, Jav
There is no operator precedence in this case. What you are questioning is like in f(callback)
statement the callback
function being evaluated even before f
. This can not happen.
On the other hand, in JS the ||
is one of the few places where you can watch laziness at show. The ==
operand (think as if it is an infix function like in fully functional languages) takes two arguments and the one on the left gets evaluated first. If it resolves to true
the second argument doesn't even get evaluated.