Lesson 28. Extending classes
After reading lesson 28, you will
- Know how to extend classes to create more customized classes
- Learn how to use libraries that provide a base class
- Understand how inheritance works with classes
- Know how to use super to invoke functions on the superclass
The best feature classes offer over traditional constructor function declarations is their ease of extension. Many consider the syntax for extending constructor functions clunky. This has led many library authors to create their own ways to extend base objects in their libraries. With built-in extendable classes, developers can learn one simple syntax that can be used everywhere. One crucial aspect to keep in mind when extending classes in JavaScript, however, ...
Get Get Programming with JavaScript Next 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.