DEV Community

Discussion on: What do you do when you encounter a hard to fix bug?

Collapse
 
hjfitz profile image
Harry

If it's been killing me, I'll grab another dev if they're free for a round of ping pong and talk through it. Rubber duck debugging has never failed.

I normally start with console logs, to see what data looks like around the function and try to narrow down the problem error - that's the most important step for me. This normally works.

Once I've got it narrowed down, and it's not fixed, I pull the debugger out and step through each line of code. Chrome is great for this, you can just put the line debugger; in your code and it'll pop up in chrome.

If that's not fixed it, I'll either leave it for the day (I've often come up with solutions on my commute home) or I'll blame a race condition