Chrome在展开时显示不同的对象内容 [英] Chrome displays different object contents on expand
问题描述
为什么Chrome会显示两个不同的数据集,具体取决于您是否扩展了对象视图?
Why does Chrome display two differing datasets depending on if you have the object view expanded?
在缩小视图中,我的对象有两个属性:
In contracted view, my object has two properties:
在扩展视图中,我的对象有三个属性:
In expanded view, my object has three properties:
推荐答案
您在控制台中看到的对象是特定时间点的对象快照 - 您登录时的时间。当您展开对象时,它将再次评估属性。
The object you see in the console is a snapshot of the object at a particular point in time - the time when you logged it. When you expand the object, it will evaluate the properties again.
在下面的示例中,我创建了一个具有两个数组属性的对象。我将它记录在控制台上,然后向它添加了第三个属性 c
。
In the example below, I have created an object with two array properties. I logged it the console, and then I added a third property, c
to it.
只有前两个属性仍然显示,即使我刚刚添加了第三个属性。在控制台中展开对象后,我可以看到第三个。这是该对象的最新状态。
Only the first two properties are showing still, even though I just added a third property. After expanding the object in the console, I can see the third one. It is the latest state of the object.
如果你将鼠标悬停在小蓝色 i
图标上,即可解释所做的操作:
If you hover over the little blue i
icon, it explains what it has done:
以下价值刚刚被评估。
Value below was evaluated just now.
这篇关于Chrome在展开时显示不同的对象内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!