为什么Object()=== new Object()等于false?
问题描述:
为什么返回假?
let a = new Object()
let b = Object()
console.log(a) // {}
console.log(b) // {}
console.log(a===b) // false
我也检查了a和b的原型,它是相同的.
I checked a proto of a and b too and it is the same.
那有什么区别?j
答
对象实例甚至都不相同:
Instance of objects are not the same even:
let a = new Object();
let b = new Object();
console.log(a===b) // false