In Javascript, why is there no “prototype” property for an instance or object literal?

In Javascript, any "functional object" has a prototype

> F = function() {}
F()
> F.prototype
F {}

But the "object" or "instance" does not have a prototype

> o = {}
Object {}
> o.prototype
undefined
> f = new F()
F {}
> f.prototype
undefined

However, the built-in object "Function" and "Object" have a prototype:

> Function.prototype
Empty()
> Object.prototype
Object {}

This looks pretty confusing to me.

  • Function and "functional object" have a prototype property

  • Object has a prototype property, but the "object literal" and "instance object" do not have a prototype property

What does a property mean prototype? Should the property not be in the above example prototype f f?

Does anyone have any ideas on how to explain this? Thank!

+4
source
1

( ).

Function Object , prototype, , .

Eloquent Javascript " " , :

, ( prototype) , ( Object.getPrototypeOf). Function.prototype, . prototype , , .

+4

All Articles