How to display local area variable in chrome javascript console

I am using javascript chrome console to debug some javascript. And often I use the interactive command line to display some variables. When I am in a function (stopped by a breakpoint) and type the name of the parameter (in my case, "result") on the command line, it displays the value of the result of the global region, and not the result of the local region. Is there a way to tell the chrome command line to evaluate a local scope or an internal variable with scope instead of a global scope variable?

greetings.

+5
source share
1 answer

You seem to be wrong. I will try the following example:

var b=1;
function foo() {
    var b=2;
    debugger
}
foo();

"b" is equal to 2, even if you declare one function inside another, if you declare "b" with "var", you will see what you want.

Any further info? maybe you have some sample code?

+1
source

All Articles