JS Coding Questions Logo
JS Coding Questions
#51🎯 Exercise💻 Code

JavaScript Coding Exercise 51

Advertisement

728x90
javascript
1class Vehicle {
2
3constructor(name) {
4
5this.name = name;
6}
7
8start() {
9
10console.log(`${this.name} vehicle started`);
11}
12}
13
14class Car extends Vehicle {
15
16start() {
17
18console.log(`${this.name} car started`);
19
20super.start();
21}
22}
23
24const car = new Car("BMW");
25
26console.log(car.start());

Choose the correct output:

A
SyntaxError
B
BMW vehicle started, BMW car started
C
BMW car started, BMW vehicle started
D
BMW car started, BMW car started

Advertisement

Responsive Ad
50of86