0

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

Roy
  • 503
  • 2
  • 8
  • 20

1 Answers1

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.

Bergi
  • 630,263
  • 148
  • 957
  • 1,375