Why is `Object() === new Object()` equal to `false`? [duplicate]

怎甘沉沦 提交于 2019-12-11 14:49:20

问题


Why it returns false?

let a = new Object()
let b = Object()
console.log(a) // {}
console.log(b) // {}
console.log(a===b) // false

I checked a proto of a and b too and it is the same.

So what is the difference?j


回答1:


Instance of objects are not the same even:

let a = new Object();
let b = new Object();
console.log(a===b) // false


来源:https://stackoverflow.com/questions/49475999/why-is-object-new-object-equal-to-false

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!