Problem 1.

Because the work is to use IDEA for Java development, but also write JS for page display. Idea for Java breakpoint debug function is very powerful, has been very confused if I want to debug JS, how should I debug?

2. How to debug

2.1 Sources breakpoint

Some time ago, I accidentally clicked a breakpoint in the js code of console Sources. When executing, I got stuck in this line of code and found that I could see the parameter change. To do this, see the following figure (line 6)

  • At the break point where you need to debug the code, refresh the corresponding page
  • Press F8 to jump breakpoint, and place the mouse on the parameter you want to see, you can see the parameter value change, very convenient

3. Summary

  • Chrome browser is very powerful, because I am a front-end white, for this debugging method, is I accidentally discovered in the learning process, after the query there are many more technical debugging method, but if you are like me mainly write Java, js debugging requirements are not high, you can try Sources breakpoint debugging.
  • In actual production, debug is very important. It not only helps you to debug errors, but also helps you to clarify the code logic. In particular, reading other people’s code can improve efficiency.
  • For more front-end debugging methods: juejin.cn/post/684490…