Prototype object (Definition)

Prototypes are analogous to default instances in a truly object-oriented system.

Availability:

ECMAScript edition - 2

Prototypes are analogous to default instances in a truly object-oriented system. A constructor would copy this default instance to create a new instance of its object class.

A prototype is an object that implements structure, state, and behavior inheritance. When a constructor creates a new object, that new object implicitly refers to the constructor's associated prototype to resolve property references.

Prototypes can be referenced using the dot separated object hierarchy notation. With an object constructor called myObject, its prototype would be accessed like this:

myObject.prototype

If any properties are added to the prototype, they will be shared by and available to all objects created by the constructor associated with that prototype. Such objects may override the inheritance by having identically named properties added to them directly.

A prototype would be expected to support the following property by default:

It should also support the following method by default:

Cross-references:

ECMA 262 edition 2 - section - 4.3.5

ECMA 262 edition 3 - section - 4.3.5