How to Debug javaScript Error Using Firebug?
6 Answers
Just check the line on which the error is occuring, then, just before that line, write a "debugger" call.
debugger; //Will invoke FireBug's debugger.
var err = abcs; //Line containing error
3 Comments
debugger key word for fire bug. I was using break points in js for that purpose. Up voted .Use the console.log(yourObject) function to output anything to the firebug console. It is just like running a var_dump and you can view all your objects and their contents. This is very helpful if you want to check on the contents of a particular variable or even a particular DOM object.
Instead of using cheap alerts - the console.log() function is cleaner and you can see all the outputs neatly in your console pane.
Note however you need to remove all references to the console.log function when you deploy your website as it would not run in IE.
Comments
you can put breakpoints in the code, and wait for the execution to hit them. Then you can walk in the code, and use watches to know the values of variables.
1 Comment
Why Firebug , try Visual studio , it has a rich debugging features ;)