What is the difference between the nullish coalescing operator (??) and the logical OR operator?
- A ?? falls back only when the left side is null or undefined; logical OR falls back for any falsy value
- B They behave identically in every case
- C Logical OR works only with boolean operands
- D ?? works only with numeric operands
Answer
?? falls back only when the left side is null or undefined; logical OR falls back for any falsy value
This matters when 0 or an empty string are legitimate values. count ?? 10 keeps a real 0, whereas the OR form would replace it with 10.





