HTML / CSS / JavaScript Tutorial

JavaScript property: prototype

[this page | pdf | back links]

The prototype property (when applied to a JavaScript object class) allows the developer to add new properties and methods to that class.


It is a global object constructor available for all JavaScript objects. For example, Boolean.prototype does not refer to a single Boolean but to the Boolean() object itself.


It has the following syntax (with no parameters):


ObjectClass.prototype.name = value


Where value is typically a function definition and name is the new method or property to be included in the object class.


Contents | Prev | Next | JavaScript Objects

Desktop view | Switch to Mobile