|
Answer» The object-oriented features supported in ES6 are: - Classes: We can create classes in ES6. The class function essentially builds a template from which we may later create objects. When a new INSTANCE of the class is created, the constructor method is invoked.
- Methods: Static methods can also be found in classes. A static method, unlike an object, is a function that is BOUND to the class. A static method can't be called from a class instance.
Let's take a look at getters and setters for a moment. Encapsulation is a FUNDAMENTAL notion in OOP. Data (object properties) should not be directly accessed or UPDATED from outside the object, which is a crucial aspect of encapsulation. A getter (access) or a setter (modify) are particular methods we define in our class to access or edit a property. - Inheritance: It is also possible for classes to inherit from one another. The parent is the class that is being inherited from, and the child is the class that is inheriting from the parent.
|