Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Salesforce Exam CRT-600 Topic 2 Question 68 Discussion

Actual exam question for Salesforce's CRT-600 exam
Question #: 68
Topic #: 2
[All CRT-600 Questions]

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.

Show Suggested Answer Hide Answer
Suggested Answer: A

Contribute your Thoughts:

Ilene
9 days ago
Hah, good one! Yeah, those other options are pretty ridiculous. I'm glad we're all on the same page here. The `super(plate)` call is the key to making this work correctly.
upvoted 0 times
...
Reita
10 days ago
Alright, I'm convinced. Option A is the way to go. *chuckles* I wonder if the exam writers are trying to trip us up with those other options. They're like the equivalent of 'banana' as the answer to a math question.
upvoted 0 times
...
Bernardo
11 days ago
Yeah, that makes sense. The other options don't seem quite right. `super.plate = plate` wouldn't work because `super` doesn't have a `plate` property, and the other options are just trying to directly set the `plate` property, which wouldn't inherit it from the parent class.
upvoted 0 times
...
Ezekiel
12 days ago
I agree, option A seems to be the way to go. `super(plate)` will call the constructor of the parent class (`Vehicle`) and initialize the `plate` property.
upvoted 0 times
...
Rolland
15 days ago
Okay, let's think through this step-by-step. The `Truck` class extends the `Vehicle` class, which means it inherits the `plate` property. So, we need to call the `super` constructor to initialize the `plate` property.
upvoted 0 times
...
Beckie
16 days ago
Hmm, this is a tricky one. We need to understand the relationship between the `Vehicle` and `Truck` classes to answer this correctly. I'm leaning towards option A, but I'm not 100% sure.
upvoted 0 times
...

Save Cancel
az-700  pass4success  az-104  200-301  200-201  cissp  350-401  350-201  350-501  350-601  350-801  350-901  az-720  az-305  pl-300  

Warning: Cannot modify header information - headers already sent by (output started at /pass.php:70) in /pass.php on line 77