Sun Dial Menu
Prototype in JavaScript

Prototype in JavaScript

Objects and inheritance.

Another step along the attempt to understand the Document Object Model, the object prototype.

Much of the more advanced code that I am looking at uses JavaScript Object programing techniques.

The tutorial here gives a good basis on what is going on.

....... This way, prototype is useful in keeping only one copy of functions for all the objects (instances).


Again the MDN article/pages have an approach that is at a higher level.

Prototypes are the mechanism by which JavaScript objects inherit features from one another. In this article, we explain how prototype chains work and look at how the prototype property can be used to add methods to existing constructors.


W3C just states the facts.

All JavaScript objects inherit properties and methods from a prototype:

  • Date objects inherit from Date.prototype
  • Array objects inherit from Array.prototype
  • Person objects inherit from Person.prototype

The Object.prototype is on the top of the prototype inheritance chain:

Date objects, Array objects, and Person objects inherit from Object.prototype.

Top Menu

Site design by Tempusfugit Web Design -