Debugger; keyword

From FirebugWiki

(Difference between revisions)
Jump to: navigation, search
m (Changed code block to use syntax highlighting)
Line 4: Line 4:
'''Example:'''
'''Example:'''
-
<code>
+
<syntaxHighlight lang="javascript">
   function test(variable) {
   function test(variable) {
     for(var i=0; i<10; i++) {
     for(var i=0; i<10; i++) {
Line 11: Line 11:
     }
     }
   }
   }
-
</code>
+
</syntaxHighlight>
== Discussion ==
== Discussion ==
* On ''breakpoint markers'': http://groups.google.com/group/firebug-working-group/browse_thread/thread/6dece6d4300c971b
* On ''breakpoint markers'': http://groups.google.com/group/firebug-working-group/browse_thread/thread/6dece6d4300c971b

Revision as of 07:30, 18 May 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 Mini Menu.

Example:

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

Discussion

Personal tools