From my observation, debugging is the best-kept secret of the developer life. Everyone is doing quite often, some are doing it even every day, but rarely anyone is talking (not moaning :)) about it publicly. Have you seen excellent tech talk at the recent conference, that has addressed some debussing techniques or anything that can be used next time one should find a way to fix the bug? If yes, please, please, please, share it in the comments.
Recently, I was fixing a bug, and complication in it was that it was crashing in the function that was used all over our codebase, so it was tough to identify where exactly the problem is. One of the ways to determine the stack trace (call path taken to reach the point at which function was called) is by using the DevTools Sources tab and putting the
debugger;statement in the function itself. However, when the function is called numerous times and is executed even on mouse move, this can become a very annoying way to trace cases in which function failed.
Another way to find out sack trace is to use
console.trace(); by putting it in the function before it above to fail. I found that for cases, when function is common and is called in numerous places, this way is much easier for debugging, as all that it is needed to check just last log of this function in console before the error is logged, and here it – stack trace for particular case, when function failed.