Arithmetic (+ - * / %), logical (&& || !), and comparison operators drive control flow.
Truthy and falsy
Falsy: false, 0, '', null, undefined, NaN. Everything else is truthy—including '0' and [].
Nullish coalescing
?? returns right side only when left is null or undefined—unlike || which treats 0 as missing.
Important interview questions and answers
- Q: || vs ??
A: || treats 0 and '' as falsy; ?? only null/undefined. - Q: Short-circuit &&?
A: Stops evaluating when left is falsy—used for guards.
Self-check
- Name four falsy values.
- When is ?? better than ||?
Pitfall: == coerces types—prefer ===.
Interview prep
- === vs ==?
Strict equality avoids type coercion surprises.