ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 106 - Certified JavaScript Developer I discussion

Report
Export

Refer to following code:

class Vehicle {

constructor(plate) {

This.plate =plate;

}}

Class Truck extends Vehicle {

constructor(plate, weight) {

//Missing code

This.weight = weight;

}

displayWeight() {

console.log('The truck ${this.plate} has a weight of ${this.weight} lb.');}}

Let myTruck = new Truck('123AB', 5000);

myTruck.displayWeight();

Which statement should be added to line 09 for the code to display 'The truck 123AB has a weight of 5000lb.'?

A.
Super.plate =plate;
Answers
A.
Super.plate =plate;
B.
super(plate);
Answers
B.
super(plate);
C.
This.plate =plate;
Answers
C.
This.plate =plate;
D.
Vehicle.plate = plate;
Answers
D.
Vehicle.plate = plate;
Suggested answer: B
asked 23/09/2024
Andrew dela Cruz
35 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first