What operators do
An operator is a symbol that takes values, called operands, and makes a new value. In 7 + 6 the operator is + and the result is 13. This script uses arithmetic, comparison and logical operators.
Arithmetic
let makes the variable a, and = puts 7 in it. Here = is the assignment operator: it stores the value on its right in the variable on its left. It does not compare anything.
Line 2 stores "7" in b. The quotes make it a string: a piece of text, not a number. It looks like 7, but its type is different, and some operators treat text differently.
Line 3 has two operators. As in maths, * goes before +. The engine reads 7 from a, works out 3 * 2 = 6 first, then 7 + 6 = 13, and stores 13 in sum.
When either side of + is a string, + joins text instead of adding. So "7" + 3 gives "73", a string, not the number 10. Joining text like this is called concatenation.
Comparing values
Line 5 compares a and b with ==, loose equality. When the types differ, == converts first: the string "7" becomes the number 7. Then 7 equals 7, so the result is true, and console.log prints it.
Line 6 uses ===, strict equality. It never converts. a is a number and b is a string, so they are not equal, even though both show 7. The result is false.
sum > 10 is true, because 13 is more than 10, and a !== 0 is true, because 7 is not 0. && means and: it gives true only when both sides are true. So line 7 prints true.
Use === and !== to compare. They never convert types, so there are no surprises. And remember: one = stores a value, while === compares two values. Mixing them up is a common beginner bug.
What happens
// step 1/9 · operators
operator a symbol that makes a new value
operands the values it works on
7 + 6 → 13
arithmetic + - * / %
comparison == === != !== < > <= >=
logical && || !
assignment =
The full rules for == (IsLooselyEqual in the ECMAScript specification) have several cases. A string compared with a number is turned into a number first, and null == undefined is true. === (IsStrictlyEqual) never converts: values of different types are never equal. The figure draws comparing as its own station so you can see it. In reality the JavaScript engine does every operator, including the comparisons.