Object.create(null) 和 {} 区别是什么 看vuex源码定于对象都是Object.create(null) 为何不直接使用 {}
1 回答

隔江千里
TA贡献1906条经验 获得超10个赞
Object.create(null)
没有继承任何原型方法,也就是说它的原型链没有上一层。
console.log(Object.create({}).toString); // function toString() { [native code] }
console.log(Object.create(null).toString); // undefined
添加回答
举报
0/150
提交
取消