Operator Precedence

The full precedence table

Now that the comparisons and the logical operators have joined the arithmetic ones, here is the whole ordering in one place. JavaScript works down this list: everything on a higher row is settled before anything on a lower row gets its turn.
PrecedenceOperatorOperation
highest**exponentiation
! and unary -logical not, negation
*, /, %multiplication, division, remainder
+, -addition, subtraction
<, >, <=, >=comparisons
===, !==, ==, !=equality tests
&&logical and
||logical or
lowest=assignment
The arithmetic operators sit at the top, so they finish before any comparison starts. The comparisons sit above && and ||, so each side of a logical operator is reduced to a single boolean before it gets combined. Assignment is at the very bottom of the table, which is exactly what you want: the whole right-hand side is worked out first, and only then is the result stored.
Both of those are correct as written, but a reader has to reconstruct the grouping in their head. Adding parentheses is often worth it. They change nothing about the meaning; they just put the grouping JavaScript already chose onto the page where it can be seen.
The program below checks a game rule. A level unlocks for a player with at least 3 stars, or for one who has a key and has finished the tutorial. It prints the rule as written, the same rule with the parentheses JavaScript uses, and the other grouping. Run it, then change it and run it again:
• Set stars to 1.
• Set finishedTutorial to true.
• Press Reset, then delete the parentheses around stars >= 3 || hasKey in the last line.
let stars = 4;
let hasKey = true;
let finishedTutorial = false;
let unlocked = stars >= 3 || hasKey && finishedTutorial;
console.log("Unlocked:", unlocked);
console.log("Same, with parentheses:", (stars >= 3) || (hasKey && finishedTutorial));
console.log("Grouped the other way:", (stars >= 3 || hasKey) && finishedTutorial);
Output
Press Run to see what this program prints.

Note: This IDE is for experimenting with the code in this lesson. Your changes are not saved, and refreshing the page puts back the original lesson code.

The exclamation mark grabs only what is next to it

This is where JavaScript and Python part company. Python's not sits BELOW the comparisons, so not a < b means not (a < b). JavaScript's ! sits near the top of the table, above the multiplications, the additions and every comparison, so it is applied to the single value immediately to its right and nothing more. If you want to negate a whole comparison, you have to write the parentheses yourself.
let stock = 12;
console.log(!(stock < 20)); // false, the comparison itself is negated
One more piece you will need: a boolean dragged into a numeric comparison is converted first, with true counting as 1 and false counting as 0.
console.log(true > 0);   // true