How to Debug Javascript

Determine if debugger; is the correct tool for this situation., Before the problem area, enter the statement: debugger; , Open your browser's developer tools by right clicking and selecting inspect element., Once inside of developer tools, run your...

12 Steps 1 min read Medium

Step-by-Step Guide

  1. Step 1: Determine if debugger; is the correct tool for this situation.

    Ask yourself:
    Do I need to look at this in great detail? Do I want to know the values, and the path the program is taking? Can I effectively test this through the developer window?
  2. Step 2: Before the problem area

    , This will be browser specific, but they should all work very similarly. , This time it will stop at the debugger; statement. ,, You may have to restart your program to trigger the debugger; again. ,
  3. Step 3: enter the statement: debugger;

  4. Step 4: Open your browser's developer tools by right clicking and selecting inspect element.

  5. Step 5: Once inside of developer tools

  6. Step 6: run your code again.

  7. Step 7: Step through your program

  8. Step 8: line-by-line

  9. Step 9: by pressing F10.

  10. Step 10: Repeat the process as necessary.

  11. Step 11: Once you've used the debugger to solve the problem

  12. Step 12: be sure to remove the statement when you're done.

Detailed Guide

Ask yourself:
Do I need to look at this in great detail? Do I want to know the values, and the path the program is taking? Can I effectively test this through the developer window?

, This will be browser specific, but they should all work very similarly. , This time it will stop at the debugger; statement. ,, You may have to restart your program to trigger the debugger; again. ,

About the Author

S

Sarah Scott

A passionate writer with expertise in practical skills topics. Loves sharing practical knowledge.

31 articles
View all articles

Rate This Guide

--
Loading...
5
0
4
0
3
0
2
0
1
0

How helpful was this guide? Click to rate: