user3474300
user3474300

Reputation: 105

Function.prototype.__proto__ → Object.prototype

console.log(Function.prototype.__proto__); //Object {}
Why not Object.prototype?
KFzI3

Upvotes: 0

Views: 189

Answers (3)

Bergi
Bergi

Reputation: 665485

Why not Object.prototype?

Because objects don't have "names", and the console does not know that the object you just logged is the one that is (or can be) referred to as Object.prototype.

Instead, it just sees that there are no enumerable properties ({}), and that it has a .constructor property which refers to a function whose .name is the string Object.

Upvotes: 0

Joseph
Joseph

Reputation: 119887

enter image description here

You can check this out in Dev tools. Go to the sources tab and under Watch Expressions section. Watch Function and you'll see the breakdown of the prototype chain. More about it on MDN.

Upvotes: 0

c-smile
c-smile

Reputation: 27470

It is exactly Object.prototype.

Try this:

alert(Function.prototype.__proto__ === Object.prototype);

Upvotes: 3

Related Questions