Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a JavaScript function to make Google Chrome break into the debugger?

Tags:

javascript

I am looking for something like Debugger.Launch() in .NET, which breaks into the debugger programmatically.

I am not looking for a cross browser way to do it, just Google Chrome is good enough.

like image 295
mark Avatar asked Feb 27 '12 09:02

mark


1 Answers

Yes, you need to use:

debugger;

The script will break exactly at line where you put debugger keyword.

To view it, you will first need to open Tools -> Developer tools (or pressing F12) and then by selecting your file from Scripts tab.

like image 126
Sarfraz Avatar answered Oct 20 '22 09:10

Sarfraz