How can a subclass be created in JavaScript?

  • Using the extends keyword
  • By defining a new class with the same name
  • Using the super keyword
  • By using the inherit keyword
In JavaScript, you can create a subclass by using the extends keyword. This allows you to inherit the properties and methods of another class, forming a class hierarchy. The extends keyword establishes a relationship between the subclass and the superclass.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *