Arithmetic Operators
5 + 2 // 7 addition
5 - 2 // 3 subtraction
5 * 2 // 10 multiplication
5 / 2 // 2.5 division
5 % 2 // 1 remainder (modulo)
5 ** 2 // 25 exponentiation
5 + 2; // always use ; at end of statementsAssignment Operators
let x = 10;
x += 5; // x = x + 5 → 15
x -= 3; // x = x - 3 → 12
x *= 2; // x = x * 2 → 24
x /= 4; // x = x / 4 → 6
x **= 2; // x = x ** 2 → 36
x++; // x = x + 1 → 37
x--; // x = x - 1 → 36Comparison Operators
5 === 5 // true — strict equal (value + type)
5 !== "5" // true — strict not equal
5 == "5" // true — loose equal (avoid)
5 > 3 // true
5 < 3 // false
5 >= 5 // true
5 <= 4 // falseLogical Operators
true && false // false — AND (both must be true)
true || false // true — OR (at least one must be true)
!true // false — NOT (inverts boolean)
// Nullish coalescing — use right side if left is null/undefined
const name = user.name ?? "Guest";
// Optional chaining — safe property access
const city = user?.address?.city; // undefined instead of errorTernary Operator
// condition ? valueIfTrue : valueIfFalse
const age = 20;
const label = age >= 18 ? "Adult" : "Minor"; // "Adult"
// Nested (keep shallow)
const grade = score >= 90 ? "A" : score >= 70 ? "B" : "C";Always use
=== and !== for comparisons. The loose == operator applies type coercion rules that surprise even experienced developers.