2

For example:

const x = 10
const f1 = () => {/* do something... */}
f1() // <<-- I'm here
console.log(x) // I want to go here without entring to f1 AT ALL but still let f1 execute.

I want to let f1 execute but I don't want to go over it.

Is it possible?


No duplication:

The other question is for finding a way to prevent any line from executing while this question is about letting lines that the only function calls execute but without the debugger to step into their execution.

Stav Alfi
  • 13,139
  • 23
  • 99
  • 171
  • Hard to prove a negative, but I don't think Chrome's devtools have that feature (yet). I've wanted it more than once. – T.J. Crowder Dec 22 '18 at 14:56
  • @Ivar It's not. The link you provide is for finding a way to __prevent any line from executing__ while this question is about letting lines that only function calls execute but without the debugger to step into their execution. – Stav Alfi Dec 22 '18 at 15:25
  • @Ivar please remove the duplication or response. – Stav Alfi Dec 22 '18 at 15:28
  • F8 aka Step Next does exactly what you are asking for – skyboyer Dec 22 '18 at 15:29
  • @StavAlfi The "_without entring to f1 AT ALL_" gave me the impression that you did not want that line to be executed at all. If you just want to skip it, can't you simply add a breakpoint on the line after and hit "resume script execution"? Or hit the "Step over" button as shown in Kaspar's answer? – Ivar Dec 22 '18 at 15:29
  • @Ivar your solution will make me add more than 150 breakpoints. and then deleting and adding them non-stop. – Stav Alfi Dec 22 '18 at 15:31
  • 2
    @StavAlfi I'm not sure why that would need 150 breakpoints. When you are paused on `f1()` you just either hit the "Step Over" button or add a breakpoint on the line below, hit "resume" and remove it again. If that does not do what you want then it might be useful to elaborate a bit more on your workflow. – Ivar Dec 22 '18 at 15:34
  • @StavAlfi Just to be clear: You are paused on `f1()`, you want to jump the `console.log` without the debugger to enter the `f1()` function, but the code in that function should still be executed? If so, [isn't that exactly what the "Step over" button does](https://i.stack.imgur.com/XwLz6.gif)? – Ivar Dec 22 '18 at 15:58
  • DevTools technical writer here. @Ivar is right. **Step Over** does exactly what you want. See [my answer](https://stackoverflow.com/a/53949794/1669860) for a demo. – Kayce Basques Dec 27 '18 at 19:17

3 Answers3

4

I want to let f1 execute but I don't want to go over it.

I assume you don't want to prevent Chrome from running f1() but just not having to step over it line by line.

If you want to step over multiple lines "Continue to here" from the context menu on the editor's ruler seems to be the best option:

Screencast how to skip code from breaking location to later line

The same option is available in the Firefox dev tools.

try-catch-finally
  • 7,436
  • 6
  • 46
  • 67
1

As Ivar mentioned in the comments, the Step Over button does exactly what you want.

In the GIF below you can see that I'm paused on doStuff(). I haven't executed it yet. After clicking Step Over I'm paused on the line of code below doStuff(). The three console.log() statements defined within doStuff() have been logged to the Console. Therefore, the doStuff() function has executed without you needing to step through every single line of the function.

demo

See Step through code to learn more about each of the code stepping buttons.

Kayce Basques
  • 23,849
  • 11
  • 86
  • 120
0
  1. Add a breakpoint to the f1() line.
  2. Comment it out /* f1() */ and press CMD + S to save.
  3. Press play

This way the function call will be commented out.

Kaspar Püüding
  • 182
  • 3
  • 10