Challenge: ES6 Inheritance
Explore ES6 inheritance by creating Vehicle and Car classes where Car inherits from Vehicle. Learn to customize constructors and methods such as turnOn and turnOff based on fuel levels and parking status. This challenge helps solidify object-oriented programming concepts in JavaScript through hands-on practice.
We'll cover the following...
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
constructorforVehiclethat initializes afuel(given in ml) property. -
Define the
turnOnandturnOfffunctions in ...