Answer the question
In order to leave comments, you need to log in
How to track js step by step?
Hello. Is there a way to track js code step by step, that is, when an action is performed, I will be shown the entire chain that was completed during this action.
Answer the question
In order to leave comments, you need to log in
If I understood everything correctly, you just need to use the debugger in the browser console. Just put a breakpoint on the desired line in the code and see the call stack. Look at this link learn.javascript.ru/debugging-chrome
So actually the code itself is a chain ..
If in some particular place you don’t know what you get, for example, in a variable, then print it to the console.
That is, you have a debugging tag, in the topic - js by steps: excel is immediately remembered and its ability to show the steps that led to the error. In js, these errors are even better displayed, the console even suggests a line and a symbol, what it is waiting for, and so on.
The code is very confusing, and there is no error in it, I look at how certain things are done in js on other sites. helps to learn to learn something new, and it’s difficult to figure it out in complex tangled webs of codes
So what do you want? In what language should you be told what is happening? As suggested by @SlaF - put breakpoints and see the current state. Or do you want you to pause, and the voice-over announcer tells you: Look, friend, we assigned the value 10 to the variable a.
Or should the program highlight what will happen next? So what's next will be what's next. If you do not understand what you have after if else, which of the conditions is fulfilled - again - either console.log, or breakpoints.
In short, I think that you yourself simply do not understand what you are asking. Decide what language the machine should speak to you.
Well, for example, there is a chain of operations, I would like that after pressing the button, I would display all the variables that were used during the execution of this process or the functions that the program accessed during this process, I am reading about the points now, I will try
The console has a call stack, using it you can track which functions were called before the breakpoint and move to the line with this function, you can also see the variables there
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question