Node.js 6和匿名对象 [英] Node.js 6 and anonymous objects
问题描述
有人知道为什么从Node.js 6.0 console.log
开始有时用匿名
开头的对象吗?
Does anybody know why starting from Node.js 6.0 console.log
sometimes renders objects with leading anonymous
word?
anonymous {val: 123}
这是什么意思,以及如何应对?
What does it mean, and how to counter it?
我正在从我正在使用的某些库中获取对象。
I am getting it for objects from some libraries that I'm using.
推荐答案
此功能最初是在Node.js 6.0.0中引入的,它是通过<$ c $进行对象检查的当将这样的对象写入控制台时,c> util.inspect 为匿名对象加上字符串 anonymous
前缀,这表示匿名对象实例化。
It is a feature that was first introduced in Node.js 6.0.0, that upon object inspection via util.inspect
prefixes anonymous objects with string anonymous
when such objects are written into the console, which denotes anonymous object instantiation.
它不影响功能,完全可以忽略。
It does not affect the functionality, and is perfectly ok to ignore.
这篇关于Node.js 6和匿名对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!