Bike Vibes Only!

Report a typo

In the following program, we have a class Vehicle with a constructor that takes brand and model as parameters, along with subclasses: Car and Bike.

Both Car and Bike extend Vehicle and have their own constructors, and inside Vehicle we have a method named info that returns a string with information about the vehicle's brand and model.

Examine the code carefully, find the error in the following code, and fix it.

Sample Input 1:


Sample Output 1:

Bike: Brand - Honda, Model - CBR250R, Type - Sport
Write a program in JavaScript
class Vehicle {
constructor(brand, model) {
this.brand = brand;
this.model = model;
}
}

class Bike extends Vehicle {
Vehicle.call(this, brand, model);
this.type = type;
}

info() {
return `Bike: Brand - ${this.brand}, Model - ${this.model}, Type - ${this.type}`;
}
}
___

Create a free account to access the full topic