It is necessary to find out the value of the variable that is declared in the function and is unattainable in the global space through the console. I do not understand how to request this value in Google Chrome. Tried to deal with breakpoints, says that the variable is not declared as well as without them.

function check() { var variable = 100; } 

It is simply impossible to query the variable variable , since it is declared in the function.

  • worth adding sample code - Grundy
  • @Grundy is done. - Telion
  • let your function return the value of this variable. In the place where you call it, you can assign it to a variable and check its value. - user180704
  • one
    Пробовал разобраться с точками остановки(breakpoints), говорит что переменная не обьявлена так же как и без них declared the Пробовал разобраться с точками остановки(breakpoints), говорит что переменная не обьявлена так же как и без них - well, it is declared .. only its value you can see only when the debugger enters the check() function ...... through you can’t see it at the console - Alexey Shimansky
  • 3
    only when the debugger enters the check () function ....... in fact, yes, after it it is necessary to set a bryak .... more precisely, there should be at least one more line, at least trite var test; , on which the breakpoint can be put ... for it cannot be put on the empty line - Alexey Shimansky

1 answer 1

To create a stopping point, just write

 debugger; 

inside the called function. Next, open the developer panel and see the necessary variables.

You can display them in the console or hover over the variable name and see the current value.

From the current place you can execute the code line by line. This is the most convenient way to find errors in complex functions.

Sample code - http://take.ms/EL0Ox

  • Thank you very much for the information. - Telion