I am quite new to javascript, I often find the need to walk through JS codes line by line to get better understanding how the code works. But manully setting breakpoints for each line in the 'source' panel of chrome is just too time-consuming, is there a way to do this automatically? In fact, in some very complicated projects, JS files are littered everywhere in the project folders, it is quite hard and troublesome to locate and open them all in the source panel. So is there a way to let chrome execute JS 1 line at a time, no matter which files the line is in?
Setting BreakpointsIn the debugger window, you can set breakpoints in the JavaScript code. At each breakpoint, JavaScript will stop executing, and let you examine JavaScript values. After examining values, you can resume the execution of code (typically with a play button).
Open Google Chrome and press F12 to open Dev Tools. Go to Event Listener Breakpoints, on the right: Click on the events and interact with the target element. If the event will fire, then you will get a breakpoint in the debugger.
Once your code breaks, there's a button beside "resume script execution" called "step over next function call" or F10, which will resume step by step.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With