K
K
Kerrik Sun2021-04-07 22:38:15
JavaScript
Kerrik Sun, 2021-04-07 22:38:15

Why put multiple breakpoints at once?

Such a question: it turns out that the breakpoint stops the execution of the script in the browser on the line on which it was set. Stopping is done once: after one stop, the script cannot stop again, because it has already been stopped .

606e0a14e19d1913065450.png

Why, then, do some programmers put several of these breakpoints when debugging? As I understand it, a breakpoint is only needed to see how the script code was executed in the browser before stopping. You can view the values ​​of variables using the "arrows" - step into, step out ...

What do I not know?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Z
Zakharov Alexander, 2021-04-07
@Eva25

>> Why then do some programmers set several of these breakpoints when debugging?
For example:
- to find out which function will be executed first
- to make sure that the program does not enter these places during execution
You can figure out how to use it yourself. In general, everything that is not forbidden is allowed.

A
acwartz, 2021-04-08
@acwartz

What don't I know?

Yes, in general, everything.
Why, then, do some programmers put several of these breakpoints when debugging?

Javascript is made up of contexts. Functions - context, file - global context. Window is a super-global context, even a variable function is a context.
One affects the other. Jumping on breakpoints, you watch how the code that has already been executed affects other code, thus monitoring the correct execution of the planned algorithm, divided into blocks. With two breaks, you can interrupt the execution of a specific part and continue debugging it, skipping the code that you don’t want to debug. I will no longer write about the fact that breaks can be generally conditional when you catch a certain stage of the cycle or the value of a variable or waiting for the execution of some complex expression.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question