Debugger; keyword

From FirebugWiki

(Difference between revisions)
Jump to: navigation, search
m (Changed code block to use syntax highlighting)
m (Renamed "Options Mini Menu" to "Options Menu")
Line 1: Line 1:
To stop script execution at a specific line inside your code you can use the <code>debugger;</code> keyword.
To stop script execution at a specific line inside your code you can use the <code>debugger;</code> keyword.
As soon as this line is reached, the execution is halted, Firebug switches to the [[Script Panel]] and a break notification is shown.
As soon as this line is reached, the execution is halted, Firebug switches to the [[Script Panel]] and a break notification is shown.
-
Break notifications can be disabled by unchecking the "Show Break Notifications" option inside the [[Script Panel#Options Mini Menu|Script Panel's Options Mini Menu]].
+
Break notifications can be disabled by unchecking the "Show Break Notifications" option inside the [[Script Panel#Options Menu|Script Panel's Options Menu]].
'''Example:'''
'''Example:'''

Revision as of 11:51, 8 June 2011

To stop script execution at a specific line inside your code you can use the debugger; keyword. As soon as this line is reached, the execution is halted, Firebug switches to the Script Panel and a break notification is shown. Break notifications can be disabled by unchecking the "Show Break Notifications" option inside the Script Panel's Options Menu.

Example:

  function test(variable) {
    for(var i=0; i<10; i++) {
      if(i == 5)
        debugger;
    }
  }

Discussion

Personal tools