在我的JS脚本中(在一个简单的html页面中),我有一个用console.log(subs)
打印的Object。在Dev Console中我看到subs
是:
> Object { topic: "hgm_giuse/#", qos: 2 }
但如果单击左侧的箭头展开对象,我会看到:
{…}
qos: 128
topic: "hgm_giuse/#"
<prototype>: Object { … }
哪个“128”来自哪里?
在第一个console.log之后刚刚修改了对象!
您可以在开发工具控制台中重现它:
a = {b: 12}
console.log(a) -> {b: 12}
a.b = 24;
console.log(a) -> {b: 24}
当您现在展开第一个已注销的对象时,它也将显示24,因为它只是对以下内容的引用:-)