I have a simple piece of JavaScript code creating object b
using Object.create
and passing object a
as the argument:
const a = {};
const b = Object.create(a);
console.log(b);
It is my understanding that Object.create
will point the __proto__
of b
to a
when creating this new object.
And I can confirm my assumption by logging some values:
console.log(b.__proto__ === a); // true
console.log(a.__proto__ === Object.prototype); // true
console.log(Object.prototype.__proto__ === null); // true
But the result of logging b
in the developer console is somewhat confusing as the value of b.__proto__.__proto__.__proto__
doesn't seem to be null
: