5

I'm using chrome's javascript console to debug some javascript. And often I'm using the interactive command line to display some variables. When I'm in a function (halted by a breakpoint), and type in the name of a parameter (in my case "result") in the command line it displays the value of the global scoped result instead of the local scoped result. Is there a way to tell chrome's command line to evaluate the local scoped or inner most scoped variable in stead of the global scoped variable?

cheers.

1
  • 1
    I believe you have free access to all variables, that would normally be accessible from the exact place the script execution was halted. Until you resume, your console operates in that scope. After you resume, the scope is window again. Commented Mar 14, 2012 at 18:52

1 Answer 1

1

Looks like you make some mistake. I try next example:

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

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

Any additional information? maybe you have an example of code?

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.