Thursday, 28 February 2013

Debug JavaScript with Firebug


Description

Firebug is a very powerful tool when it comes to finding and solving errors in code.
Here are the ways you can deal with errors of JavaScript code within a page. For this, first you need to load the page and open Firebug. Sometimes you need to reload the page.

Indicates number of an errors in the Status Bar

debug-javascript-firebug

Shows error related to the currently open page only

debug javacript firebug 1

Shows detail information about the error

debug-javascript-firebug2

Execute code one step at a time

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

debug-javascript-firebug6

Using Break Point, Step Over

Break Points can be used to stop the execution of the code. This gives you a scope to check whether the program has got any error till the BreakPoint, which is very useful for debugging.
If you click Step over button, Firebug updates all the variables until your breakpoint and listing them on the right side of the debug window.
javascript debug firebug

Use an expression against which the Break Point will be working

You can write an expression, so that if only if that condition is true, BreakPoint is going to stop the execution of the code.
debug-javascript-firebug4


No comments:

Post a Comment