I've read and tried understanding other answers similar to this question as well (like this one), But still the concept of prototypal inheritance is not very clear to me. and right now the thing that's confusing me the most is, that what is the actual difference between __proto__
and [[ Prototype ]]
? As far as I've been able to understand is that [[ Prototype ]]
is an "internal linkage that ties one object to another". But it gets ambiguous when I see a tutorial on youtube, because whenever they create an object and if they try to log it using console.log
in their browser's console then it actually has the __proto__
property in it but when I try to do the same it outputs [[ Prototype ]]
instead. So I'd like to know why is it so? and what is an "internal link"? Thanks in advance! :)
Below's the code that outputs "[[ Prototype ]]" in chrome and "<prototype>" in firefox.
function User(firstName, lastName) {
this.firstName = firstName;
this.lastName = lastName;
}
const user = new User("Someone", "Something");
console.log(user);