扫码关注官方订阅号
顺便区分下 {} , Object.create(null) , null , new Object();
闭关修行中......
{}与Object.create(null)的区别: 前者的__proto__属性是Object, 后者的是undefined(经 @猪了个去 提醒, 此处应为undefined, 不是null);null不是对象;new Object()和{}应该是等价的.
{}
Object.create(null)
__proto__
Object
undefined
null
new Object()
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
{}与Object.create(null)的区别: 前者的__proto__属性是Object, 后者的是undefined(经 @猪了个去 提醒, 此处应为undefined, 不是null);null不是对象;new Object()和{}应该是等价的.