ARTICLE AD BOX
I’m trying to understand how Chrome DevTools is showing the prototype of a plain object.
const obj = {};
console.dir(obj);
When I expand the logged object:
Expand Object
Expand [[Prototype]]
I see:
__proto__: ObjectMy question: Why is __proto__ shown as Object and not null?
If I expand that __proto__, I see all the properties from Object.prototype.
This feels odd to me, because expanding the outer Object already shows Object.prototype, so I’m not sure why both levels display similar content.
But if I run:
Object.getPrototypeOf(obj)
Chrome shows something that looks like:
__proto__: null //which is expectedSo I’m trying to figure out:
Why the logged object shows [[Prototype]]: Object, instead of nullIt seems like DevTools displays prototypes differently depending on how you inspect them, and I want to understand what’s actually happening.
