. Logging is quickly abandoned for debugging with breakpoints because it can give you far more information and doesn’t require extra code that should be cleaned up later. Yet there are some instances where you wouldn’t want to break application flow with breakpoints, such as during dragging or animations. In those cases, logging can be the best choice to gain insight into what’s happening without stopping the action.
Step 1: Put a regular breakpoint where you want to log
This part is pretty easy. If you’re not experienced with breakpoints, you click on the line number in the Chrome debugger where you want to have your breakpoint.
Step 2: Edit the breakpoint
To edit a breakpoint, right click on the breakpoint and select edit breakpoint.
Step 3: Put the logging in the breakpoint
How it works
So, remember edited breakpoints only stop when the expression is true. This tells us two things: the debugger executes that code each time the breakpoint would be hit and if the expression returns false the breakpoint doesn’t stop.
is falsy (find out more about truthy and falsy) so the code gets run but the breakpoint doesn’t get triggered.