Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to set breakpoints for every js line in the chrome dev tools?

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?

like image 880
shenkwen Avatar asked Jun 15 '15 22:06

shenkwen


People also ask

Can you set breakpoints in JavaScript?

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).

How do I debug JavaScript events in Chrome?

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.


1 Answers

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.

like image 158
Felix Guo Avatar answered Oct 11 '22 21:10

Felix Guo