Challenge: ES6 Inheritance
This challenge will test your skills in implementing inheritance and constructors in ES6 version of JavaScript.
We'll cover the following...
Problem statement
In this challenge, there are two classes, Vehicle
and Car
. You need to implement inheritance between them so that Car
is the child class and Vehicle
is the parent. You have the following tasks:
-
Define a
constructor
forVehicle
that initializes afuel
(given in ml) property. -
Define the
turnOn
andturnOff
functions inVehicle
. ...