They are not equivalent. {}.constructor.prototype == Object.prototype
while Object.create(null)
doesn’t inherit from anything and thus has no properties at all.
In other words: A javascript object inherits from Object by default, unless you explicitly create it with null as its prototype, like: Object.create(null)
.
{}
would instead be equivalent to Object.create(Object.prototype)
.
In Chrome Devtool you can see that Object.create(null)
has no __proto__
property, while {}
does.