DT
←
Back to Blog
JavaScriptDecember 27, 2025 • 6 min read

The $47,000 Bug:
That Taught Me to Stop Using ||

A property management company lost thousands due to a single character. Learn why || is dangerous and how ?? saves your production apps.

📝 Show Notes & Ideas▼
📝
Notes & Ideas

Danny's Quick Takes:

  • →0 is Data, Not Nothing. The || operator treats 0 as falsy, which destroys valid data like "0 pets" or "0 items in cart".
  • →Use ?? by Default. The Nullish Coalescing Operator (??) only triggers on null or undefined, respecting valid falsy values like 0, false, and "".
  • →The Cost of Invisible Bugs. This bug cost a client $47,000 in manual labor. "It looks fine" is not an engineering standard.

The Bottom Line:

Stop using || for default values. It's a legacy habit that introduces subtle, expensive bugs. Switch your mental model to ??.

0

© 2026 DTHOMPSONDEV. All rights reserved.

RRSS Feed