Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
4.3k views
in Technique[技术] by (71.8m points)

console.log打印和对象属性改变哪个在前????

image.png
image.png

为什么前后两次的打印结果在浏览器里显示一样
第一次的console.log(obj)打印的时候下面的代码已经执行完成了吗?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

同时回答你和楼上,浏览器使用console.log进行数据打印时,打印的是快照,但是如果是对象的话,当你展开时,会重新去读一遍内存真实的值然后显示,所以展示的都是最新值/当前值,你鼠标悬停在对象右边的感叹号上,就会出现提示value below was envalueated jast now


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...