1

Is there way to see the scope chain objects in chrome devtools or in any browser.

For the below code I can only find the global variable and also for nested functions as well, I am only seeing the global variable. Can anyone help with this. Please guide me if I am not in the right direction.

E.g.

var global = "Global var";
function f1() {
    var local = "Local var";
};

Screenshot from google chrome devtools

1

1 Answer 1

2

The closure scope of that function is the global scope.

If you want to see the local scope of that function, you need to call it:

var global = "Global var";
function f1() {
    var local = "Local var";
    debugger;
};
f1();

Then use the scope view of your debugger.

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.