While I'm still trying to read βYou Don't Know JS,β I'm starting to have a good idea (I love this series). I think I have a prototype, but I came across below code.
var myObject = { a:2 }; Object.getOwnPropertyDescriptor(myObject, "a");
And although I fully understand the result and its meaning, I tried to use my understanding (or lack thereof) of the prototype and wanted to do it below.
myObject.getOwnPropertyDescriptor
I thought that it would move the proto chain to the prototype of the object and get this method, but as it turned out, the prototype of the object does not have this (suppose that this is not part of the prototype of the object, I look at the document, at least I do not consider it part prototype, and he says this is a method). Therefore, instead of being Object.prototype.getOwnPropertyDescriptor, I assume it is just Object.getOwnPropertyDescriptor.
I understand this correctly and why is the cause of the Object method not in all prototypes?
source share