Skip to main content


Isolating a bug

Using a debugger

Comment code out to find the source of a bug

  • Comment things out until the bug is gone
  • every time I need to find where a bug is coming from I forget to do this and start dropping console logs.
  • When you’re 100% sure you’re in the right place, by all means do that. But when you’re looking for the right place, don’t jump the gun.
  • First, start commenting out big chunks. Ideally, you want to bisect. Happened yet again this week. Keys. Logged all keys, looking for duplicates. Didn’t see any. Double checked everything. 30 minutes went by. Took a break for lunch and almost immediately realized I’d skipped a step.
  • Always confirm the problem is still happening. Then always confirm you’ve found the source.
  • Don’t guess. Narrow down.
  • Some like git bisect to find the commit where it started.
  • I like using the stack trace to find the file and then comment / uncomment my way to it.
  • Once I found it, the fix was easy. Locating it was the true challenge.

Bundle size

  • 🧰 BundlePhobia • See the cost of adding an npm package to your bundle in terms of size and download time