Challenge: Solution Review
This lesson will explain the solution to the problem from the last coding challenge.
We'll cover the following...
We'll cover the following...
Solution #
Explanation
Let’s start by going through the original code, so we can understand how to modify it.
You can see that the original code implements inheritance to create a customized character. It has a SuperHero class that looks like:
class SuperHero {
constructor(name,power) {
this.name = name
this.power = power
}
}
Each SuperHero instance will have a name and power. Next, there are three child classes, all of which extend the functionality of the SuperHero class like so: