A zero gets replaced
Take your time, follow the code and check your understanding.
The codeConditions
const count = 0;
const shown = count || 10; // should preserve zeroYour answer3 min · no timer
Show solution and explanation
|| replaces all falsy values. ?? preserves zero and falls back only for null or undefined.
Use ?? because zero is falsy.