Alex Rivera | Logout

Programmatically stop JavaScript execution in Firebug

Asked 2009-08-12T11:35:56.093
72

I am currently debugging complex JavaScript code with Firebug. I am looking for a way to stop the JavaScript execution as if it was a breakpoint programmatically.

Example:

instructions ...
degugger.breakpoint(); // the execution stops here as if a breakpoint was
                       // manually set
other instructions ...
Edit
Report

1 Answer

125

You can use the debugger statement:

// your JS code
...
// break here
debugger;

It works in all major browsers.

answered 2009-08-12T11:40:36.257

Your Answer