Sign in


jpwzv edited in Wed, 11 Aug 2021
I adjusted it three times Object.getPrototypeOf Different results have been obtained. I want to call, but if I initialize obj to new date(), then obj is an object, connected to Date.prototype This is the resultI don't quite understand the first one. Since the first one is when a function is initialized, why is it different after several successive adjustments.
2 Replies
commented on Wed, 11 Aug 2021

that is because

Object.getPrototypeOf(Date) === Function.prototype // true
Object.getPrototypeOf(Function.prototype) === Object.prototype //true
Object.getPrototypeOf(Object.prototype) === null //true

You can refer to this series of articles for a very detailed understanding of JavaScript prototypes and closures

commented on Wed, 11 Aug 2021

Your obj is always covered by the value of getprototypeof, which is different every time

lock This question has been locked and the reply function has been disabled.