Tell me about a difficult bug you tracked down in JavaScript. How did you approach it?
Note: The interviewer is testing your debugging method, not your luck. Pick a bug that needed reasoning rather than one you fixed by chance.
Tell it as a narrowing process:
- How you reproduced it. The hardest part of most JavaScript bugs is making them happen on demand — a race that only appears on slow connections, a state bug that only appears after a specific navigation order.
- How you bisected. Commenting out halves,
git bisect, or a breakpoint moved progressively earlier until the state was still correct. - The tools. Conditional breakpoints, the Network tab for a response that was not the shape you assumed, the Performance panel for a rendering problem, or simply logging the value and its
typeof. - The root cause. Good candidates: a stale closure capturing an old value, an
awaitinside a loop that silently serialised requests, mutation of an object someone else held a reference to, orthislosing its binding in a callback.
Finish with the test you wrote so the bug could not return.





