Effective Method for debugging JavaScript errors-using firebug

Source: Internet
Author: User

First open the Firefox plug-in: firebug, check the script "enable", and check"Interrupt at all errorsAnd then refresh the running website. If a JS error or exception occurs, firebug automatically loads the error JS and stops it in the wrong row. At this time, you need to view the value of the variable (you can see the value of the variable in the "Monitor" on the right side, you can also see the value of the variable through the mouse, you can also establish a monitoring expression ). If the value of the variable is null or undefined, it is generally that the value passed by the caller is null, so find the Caller: You can see the call tree on the "stack" page on the right, click on the caller layer to find out which level of passed parameters are faulty. After locating the real error source, you can set a breakpoint before it and run the website again to locate the error. Note:

Single-step debugging: Enter (F11), skip (F10), and exit in one step,

Monitoring: Variable value and monitoring expression

Stack: Call tree

Breakpoint: List all breakpoints and cancel a breakpoint.

Set breakpoints: Click Set breakpoint on the leftmost side and right-click to set the expression:"Stops at the breakpoint only when the expression is true.".

 

Refer:

Firebug advanced usage-powerful web development tool

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.