DELAPARRA
Index
Color
NL
Category: Programming paradigms

Prototype

Explained by Updated

What is Prototype?

Prototype: An existing object that a new object is based on, either by cloning or by delegation. In prototype-based programming, a prototype is an existing object that serves as the template for new objects. A new object can copy the prototype's properties, or simply refer back to it for anything it does not define itself.

Definition source Coders Lingo, CC BY 4.0

Frequently asked questions about Prototype

How is Prototype used in practice?

JavaScript works this way. Every object has a prototype, and when you access a property the object does not have, JavaScript looks it up on the prototype instead. Methods defined on Array.prototype are available on every array for this reason.

What should you keep in mind with Prototype?

Modern JavaScript classes are built on top of prototypes, so understanding them helps explain behaviour that otherwise seems magical. It also explains a rule: do not modify built-in prototypes like Object.prototype. Every object in the program, including those in libraries, would be affected.

At a glance

CategoryProgramming paradigms
Explained by
Updated

More Programming paradigms terms

All terms starting with P

Skills

Download all skills (zip)

Manuals

Related services

Need any help?

Stuck on one of these in your own project? Tell me what you are working on and I will tell you how I would approach it.