Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Debugging JavaScript with Firebug

Debugging JavaScript with Firebug


The Firebug website announced that development, updates and maintenance of Firebug have stopped, inviting everyone to use Firefox's built-in tools DevTools.

Description

Firebug is a very powerful tool that helps you find errors in your code and fix them.

Here we use Firebug to work with JavaScript code.

First we need to load the page and open Firebug.

Sometimes you need to reload the page.

Error count in the status bar

debug-javascript-firebug

Show errors on the current page

Show detailed error information

debug-javascript-firebug2

Step through code

You can execute code step by step. This is very useful for debugging.

debug-javascript-firebug6

Debugging with breakpoints

Breakpoint debugging can stop code execution; you can specify a code range to check whether the error lies within it. This is useful for debugging errors.

If you click the "Step over" button, Firebug updates all variables until you stop breakpoint execution in the right-hand window.

debug-javascript-firebug3

Use an expression to make a breakpoint work

You can write an expression, and the breakpoint stops code execution when the condition is true.

debug-javascript-firebug4

Search

You can use quick search to find keywords in your code.

debug-javascript-firebug5