为什么谷歌浏览器的调试器无法访问所有变量?

时间:2014-04-02 11:37:21

标签: javascript google-chrome debugging google-chrome-devtools higher-order-functions

今天遇到了Google Chrome调试器的一个有趣问题。变量看起来似乎不可用,但它只是 - 调试器无法使用。这是一些示例代码:

<script>

var foo = function(passedInThing, otherPassedInThing) {
  return {
    bar: function() {
      window.im_using = passedInThing;
      debugger;
    }
  }
}

foo("this exists", "this does not").bar();

</script>

因为我在内部函数的范围内引用了passInThing,调试器可以看到该变量并对其进行操作。但是在使用之前,其他的隔离似乎是不可见的。

据我所知,firefox似乎没有相同的限制。这是一个错误,还是有一些理由背后的呢?

0 个答案:

没有答案
相关问题