ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 214 - Certified JavaScript Developer I discussion

Report
Export

Refer to the 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 missing code for the code to display 'The truck 123AB has a weight of 5000lb.

A.
super(plate)
Answers
A.
super(plate)
B.
super.plate = plate
Answers
B.
super.plate = plate
C.
Vehicle.plate = plate
Answers
C.
Vehicle.plate = plate
D.
this.plate = plate
Answers
D.
this.plate = plate
Suggested answer: A
asked 23/09/2024
ALAEDDINE BENMAKHLOUF
46 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first