How to terminate script execution when debugging in Google Chrome?

后端 未结 11 1179
傲寒
傲寒 2020-12-07 08:16

When stepping through JavaScript code in Google Chrome debugger, how do I terminate script execution if I do not want to continue? The only way I found is closing the browse

11条回答
  •  情深已故
    2020-12-07 09:15

    There are many appropiate solution to this problem as mentioned above in this post, but i have found a small hack that can be inserrted in the script or pasted in the Chromes console (debugger) to achieve it:

    jQuery(window).keydown(function(e) { if (e.keyCode == 123) debugger; });
    

    This will cause execution to be paused when you hit F12.

提交回复
热议问题