问题描述
我有复杂的JavaScript对象,它由一些第三方工具生成,看起来像这样(在Chrome开发人员工具监视面板中):
b$ b
我有兴趣阅读 i $ c $的
和值
属性c>对象。
我从来没有见过这样的< function scope>
之前的事情。在这种情况下,
可能吗?
来源:
$ b $
i
你看到的对象是在过去的某个时刻创建的,并且暂停的功能是在创建该对象的相同外部函数内创建的。当内部函数访问外部函数的变量时,会创建一个闭包来记住它们。 您无法直接访问已关闭的变量。
p>I have a complex javascript object which is generated by some third party tool, which looks like this (inside Chrome Developer Tools Watch panel):
I'm interested in reading those text
and value
attributes of i
Object.I've never seen such <function scope>
thing before. In such cases,
Or is it not possible?
Source: MDN Closures
The i
object you are seeing was created at some point in the past, and the function you have paused in was created within the same outer function that created the object. When the inner function accesses the variables of the outer function, a closure is created to "remember" them.
You can't access the closed over variables directly.
这篇关于如何在Chrome Developer工具的Watch面板中访问< function scope>的Closure中的值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!