January 2020
Intermediate to advanced
548 pages
13h 36m
English
All functions within a class defined using the method definition syntax have the super binding available, which provides access to the super-class and its properties. The super() function is available to invoke directly (which will call the constructor of the super-class) and can provide access to specific methods (super.methodName()).
If you are extending another class and you are defining your own constructor, you must call super() and you must do so before any other code within your constructor that modifies the instance (that is, this) in any way:
class Tiger extends Animal { constructor() { super(); // I.e. Call Animal's constructor }}
If your constructor attempts to call super() after modifying the instance, ...
Read now
Unlock full access