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...
Exclusive to subscribers. 97% yet to be discovered!
Already subscribed? Log in!
Legacy and prototypes
Article included in this offer
"Digital documents and content management"
(
74 articles
)
Updated and enriched with articles validated by our scientific committees
A set of exclusive tools to complement the resources
Bibliography
- (1) - SELF UNGAR (D.), SMITH (R.B.) - Self : The Power of Simplicity. - OOPSLA '87 Conference Proceedings, pp. 227-241, Orlando, FL, October 1987
Standards
- ECMAScript® 2016 language specification - ECMA-262 - 2016
- IEEE Standard for the Scheme Programming...
Exclusive to subscribers. 97% yet to be discovered!
Already subscribed? Log in!