Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to pause debugger in chrome using javascript?

I find script pause debugger in chrome when ctrl shift I or F12. Thank everybody!

like image 308
justcntt Avatar asked Jun 25 '17 14:06

justcntt


2 Answers

Type debugger; in your js where you want debugger to pause:

Type debugger Screenshot

Then load the page while developer tools open.

Paused Screenshot

like image 152
spiders.here Avatar answered Oct 06 '22 10:10

spiders.here


Open the Devtools, you can find a tab called Sources in which press ctrl + P and enter the name of the js file you want to debug. Once you open the file, go to the line where you want to debug. Click on the line number at the point to setup a debug point. You can setup Multiple Debugging points the same way too. When the code is called the debugger will pause at the point specified.

Alternatively, In your js code you can specify debugger; which will pause the debugger at the location you want.

like image 43
Neovire Avatar answered Oct 06 '22 08:10

Neovire