Determinando a verdade com operadores lógicos
Remember also that logical operators have a
precedence just like the arithmetic operators.
! has the highest precedence, followed by && and then ||.
If you need to override the precedence, you can wrap whatever you
want to execute first in parentheses in order to give it priority.
Parentheses are always executed first. Here are some examples
demonstrating how you can control the order of operations:
let a = true;
let b = true;
let c = false;
let d = false;
a && b && c && d // Operators are executed left to right
a || b && c || d // b && c is evaluated first
(a || b) && (c || d) // a || b is evaluated, then c || d, then the &&
!(a || b) && (c || d) // same as above, but (a || b) is negated before the && is evaluated
Gorgeous Goldfinch