20 Mistakes That Quietly Destroy JavaScript/TypeScript Codebases (Part 2)
This title could be clearer and more informative.Try out Clickbait Shieldfor free (5 uses left this month).
Part 2 of a series on JS/TS codebase mistakes covers 9 practical pitfalls with before/after code examples. Topics include: mutating function parameters (use immutable returns instead), memory leaks from uncleared event listeners and timers, missing async cancellation with AbortController, fetch calls without timeouts, running independent async operations sequentially instead of with Promise.all, blocking the Node.js event loop with sync I/O or CPU-heavy work, timezone bugs with JavaScript's Date, writing tests that verify implementation details rather than behavior, and failing to validate API input at boundaries (enabling mass assignment attacks). Each mistake includes a concrete fix and production-level context.
Table of contents
Give Your AI Agent Eyes on the Web (Partner)12. Mutating Function Parameters13. Leaking Memory with Uncleared Listeners, Timers, and Subscriptions14. Never Cancelling Async Operations15. No HTTP / fetch Timeouts16. Running Independent Async Operations Sequentially17. Blocking the Event Loop18. Using Date for Everything19. Testing for Coverage, Not for Value20. Not Validating Input at the Boundary📌 TL;DR1 Comment
Sort: