Skip to content

?? vs ||: Why Your Zero Keeps Disappearing

The decisive difference between the nullish coalescing operator (??) and || — it's why 0 and empty strings get swallowed by defaults. Falsy traps, ??= assignment, optional chaining combos, and why mixing the two throws a SyntaxError.

Back to top