Open In App

How many ways are Available in JavaScript to Implement Inheritance ?

Last Updated : 29 Jan, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

Inheritance refers to inheriting the properties and methods of the parent or already existing species by the child or the newly created species. In JavaScript, we can implement inheritance in two different ways, unlike the other programming languages. The two ways of implementing inheritance are discussed below:

  • Prototypal inheritance: It is the older way of inheriting the properties and methods of a function to another function using the prototype keyword.
  • Classical inheritance: It was introduced in ES6 with the concept of classes and the OOPs in JavaScript, It is the normal way of implementing inheritance in classes using the extends keyword between the parent and the child class names.

Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads