Debug

From FirebugWiki

(Difference between revisions)
Jump to: navigation, search
(Separate Command Line API page for debug())
(Added parameter description and examples)
(One intermediate revision not shown)
Line 1: Line 1:
-
Adds a breakpoint on the first line of a JavaScript function.
+
Adds a [[Script Panel#Breakpoints|breakpoint]] on the first line of a JavaScript function.
 +
 
 +
This breakpoint can be managed via the [[Breakpoints Side Panel]].
 +
 
 +
== Syntax ==
 +
<source lang="javascript">
 +
debug(fn)
 +
</source>
 +
 
 +
== Parameters ==
 +
=== fn ===
 +
Function to set the breakpoint at. '''(required)'''
 +
 
 +
== Examples ==
 +
Having the following function:
 +
 
 +
<source lang="javascript" line="true">
 +
function test()
 +
{
 +
    console.log("test1");
 +
    console.log("test2");
 +
    console.log("test3");
 +
}
 +
</source>
 +
 
 +
<source lang="javascript">
 +
debug(test)
 +
</source>
 +
 
 +
This sets a breakpoint at line 3 (<code>console.log("test1");</code>).
 +
 
 +
== See also ==
 +
* [[undebug]]
 +
* [[Command Line API]]

Revision as of 09:21, 18 July 2012

Adds a breakpoint on the first line of a JavaScript function.

This breakpoint can be managed via the Breakpoints Side Panel.

Contents

Syntax

debug(fn)

Parameters

fn

Function to set the breakpoint at. (required)

Examples

Having the following function:

  1. function test()
  2. {
  3.     console.log("test1");
  4.     console.log("test2");
  5.     console.log("test3");
  6. }
debug(test)

This sets a breakpoint at line 3 (console.log("test1");).

See also

Personal tools