Legacy and prototypes
Javascript
Article REF: H3120 V2
Legacy and prototypes
Javascript

Author : Christian Queinnec

Publication date: February 10, 2017 | Lire en français

Logo Techniques de l'Ingenieur You do not have access to this resource.
Request your free trial access! Free trial

Already subscribed?

6. Legacy and prototypes

JavaScript is a prototype-based language, which means it provides objects but, natively, no classes. The difference between prototype-based languages and class-based languages lies in the mechanism used to create objects. In class-based languages, all objects of the same class have the same structure (the same fields) and the same behaviors (methods). In prototype-based languages, objects are created by cloning. A clone initially acquires all the properties and behaviors of the parent object (in JavaScript, this is called a prototype). It can evolve independently of its prototype and dynamically acquire (or lose) new behaviors or properties.

We will first present the prototypes, a concept on which ECMAScript 2015 has built a class system associated with new syntaxes for their declaration.

Every object (including tables, functions, regular...

You do not have access to this resource.
Logo Techniques de l'Ingenieur

Exclusive to subscribers. 97% yet to be discovered!

You do not have access to this resource. Click here to request your free trial access!

Already subscribed?


Article included in this offer

"Traceability"

( 56 articles )

Complete knowledge base

Updated and enriched with articles validated by our scientific committees

Services

A set of exclusive tools to complement the resources

View offer details
Contact us