In short: functions intended for new have prototype , instance instances do not.
I will probably refuse my exactness to say this, but prototype is something that only applies to what you might call constructor functions, which are functions that must be called with new to create instances. The prototype can be considered as a template for the resulting instance.
For the resulting object, prototype not a property. Rather, the properties in the prototype constructor are available as properties of the instance that was created. This means that when searching for an instance property, if it is not defined in the instance, Javascript will begin to check the prototype chain to determine if the file exists there.
If you want to access the instance prototype, use Object.getPrototypeOf .
Javascript semantics can be misleading. I highly recommend working through the freely readable Javascript AllongΓ© to fully understand some of the intricacies of Javascript. Chapter 8 focuses on just this topic.
acjay source share