Solution Review: Inheritance Check

This lesson will explain the solution to the problem in the previous lesson.

We'll cover the following...

Solution #

Press + to interact
class Vehicle {
constructor() {
var speed = "100";
var model = "Tesla";
}
}
class Car {
constructor() {
var speed = "100";
var model = "Tesla";
}
}
var car = new Car();
function check() {
if (!(car instanceof Vehicle)) {
console.log("Inheritance not implemented");
} else {
console.log("Good job");
}
}
check();

Explanation #

In the given problem, we can see that the student ...