Name

Function.prototype — the prototype for a class of objects

Availability

JavaScript 1.1; JScript 2.0; ECMAScript v1

Synopsis

function.prototype

Description

The prototype property is used when a function is used as a constructor. It refers to an object that serves as the prototype for an entire class of objects. Any object created by the constructor inherits all properties of the object referred to by the prototype property.

See Chapter 8 for a full discussion of constructor functions, the prototype property, and the definition of classes in JavaScript.

Bugs

JavaScript 1.1 requires a constructor to be used once before anything can be assigned to its prototype object.

See Also

Chapter 8

Get JavaScript: The Definitive Guide, Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.