Console shows [[Prototype]] and __proto__ in different positions

52 Views Asked by At

I understand that __proto__ is a getter for the value in the hidden property [[Prototype]] but the following screenshot in the Google Chrome console is a bit confusing for the following code:

function Person(name)
{
   this.name = name;
}

var newPerson = new Person("John")
console.log(newPerson);

enter image description here

enter image description here

I understand that I can call newPerson.__proto__.__proto__.__proto__ and the prototype chain ends there at null but why is it shown differently in the console? To reach a null value in the chain in the console we have to click through [[Prototype]].[[Prototype]].__proto__.[[Prototype]].__proto__.__proto__. Hence, what does the above structure mean? and how are we able to call newPerson.__proto__ when the first and only property is [[Prototype]]?

0

There are 0 best solutions below