Solution Review: ES6 Inheritance
This lesson will explain the solution to the problem in the previous lesson.
We'll cover the following...
We'll cover the following...
Solution #
Explanation #
Let’s start by discussing the implementation of the Vehicle class first.
-
On line 2, we are defining the
constructor. It initializes thefuelproperty by setting it equal to the parameter passed.constructor(fuel) { this.fuel = fuel; } -
On line 3, we are implementing the
turnOnfunction. It displays the messageTurned on.