Example 3 - Javascript Debugger
The JavaScript Debugger enables you to step through JavaScript code and examine or modify its state to help track down bugs.
There are three ways to open the debugger:
- select "Debugger" from the Web Developer submenu in the Firefox Menu (or Tools menu if you display the menu bar or are on Mac OS X)
- press the Ctrl+Shift+S (Command+Option+S on OS X) keyboard shortcut
- press the menu button ( new fx menu ), press "Developer", then select "Debugger".
You can set a breakpoint in one of the following ways:
-
in the source pane, click on the line number for the line you want to break at
-
in the source pane, activate the context menu while on the line you want to break at, and select "Add breakpoint"
-
in the source pane, highlight the line you want to break at and press Ctrl+B (Windows/Linux) or Command+B (Mac OS X)
Try to add some breakpoints and see what happens!
You can learn more about the Javascript Debugger in this MDN article.