How to debug Javascript error?

后端 未结 6 1890
囚心锁ツ
囚心锁ツ 2021-01-06 03:07

How to Debug java Script Error Using Firebug?

Duplicate

How can I set breakpoints in an external JS script in Firebug

相关标签:
6条回答
  • 2021-01-06 03:11

    Debug using FireBug.

    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
    
    0 讨论(0)
  • 2021-01-06 03:20

    To debug an error in firebug :

    • 1- select inspect tab from menu
    • 2- Set break point in the line that causes error
    • 3- Refrsh the page
    • 4- use F10 to step by step debug and F5 to end debgging

    It's like debgging of visual studio

    0 讨论(0)
  • 2021-01-06 03:23

    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.

    0 讨论(0)
  • 2021-01-06 03:24

    You can use Firebug, and for debugging in chrome, you can use firebug lite

    0 讨论(0)
  • 2021-01-06 03:24

    Why Firebug , try Visual studio , it has a rich debugging features ;)

    0 讨论(0)
  • 2021-01-06 03:30

    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.

    0 讨论(0)
提交回复
热议问题