It is very convenient to debug JavaScript using Firebug. Because js errors are not easy to find, it is much easier to use them. Procedure:
A. After opening Firebug, enable "script" debugging and find the referenced script file (or In-line js );
B. Add breakpoints at appropriate locations;
C. If the breakpoint has been executed, refresh the page and the script will be interrupted at the breakpoint. If the breakpoint has not been executed, you can directly execute the actions on the page (such as clicking a button), and the Code will be interrupted at the breakpoint;
D. Observe the function call stack, observe the local variable, and perform single-step execution and debugging.
It's really simple! The advantages of breakpoint debugging with Firebug are summarized as follows:
- Lines that can add breakpoints use green line numbers, which is very intuitive;
- Call stack is displayed in two ways, which is convenient;
- The local variables are clearly displayed.