← JavaScript learning path
JavaScript · Module 3 of 10

Operators and conditions

Compare values safely and choose paths with if, else and the ternary operator.

📖 Key ideas

  1. === compares value and type; == converts types first (avoid it).
  2. Logical operators: && (and), || (or), ! (not).
  3. if / else if / else choose what runs.
  4. Ternary: condition ? a : b.
  5. Falsy values: false, 0, "", null, undefined, NaN.
💡 Real-life example: Strict === is a bank teller checking both the name and the photo; == only checks the name.
===Strict equality: value and type
&&Logical AND
Ternarycondition ? a : b
FalsyValue treated as false