Challenge: Inheritance Check
This challenge will test you in using the "instanceof" operator to check for inheritance in JavaScript.
We'll cover the following
Problem statement #
This challenge gives you an idea of how to use the instanceof
variable. You can use it in checking for inheritance between classes.
You are given some code written by a student. The student was asked to implement inheritance by creating a Vehicle
class (containing the defined properties speed
and model
) and a Car
class, which inherits these properties from the Vehicle
class. However, as you can see, the student cheated and copy and pasted the Vehicle
class constructor.
Level up your interview prep. Join Educative to access 80+ hands-on prep courses.