Question 36

Refer tofollowing 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.'?
  • Question 37

    A developer creates a simple webpage with an input field. When a user enters text and clicks the button, the actual value must be displayed in the console:
    HTML:
    <input type="text" value="Hello" name="input">
    <button type="button">Display</button>
    JavaScript:
    01 const button = document.querySelector('button');
    02 button.addEventListener('click', () => {
    03 const input = document.querySelector('input');
    04 console.log(input.getAttribute('value'));
    05 });
    When the user clicks the button, the output is always "Hello".
    What needs to be done to make this code work as expected?
  • Question 38

    Refer to the code below:
    Const myFunction = arr => {
    Return arr.reduce((result, current) =>{
    Return result = current;
    }, 10};
    }
    What is the output of this function when called with an empty array ?
  • Question 39

    A developer wants to define a function log to be used a few times on a single-file JavaScript script.
    01 // Line 1 replacement
    02 console.log('"LOG:', logInput);
    03 }
    Which two options can correctly replaceline 01 and declare the function for use?
    Choose 2 answers
  • Question 40

    Given the HTML below:
    <div>
    <div id="row-uc">Universal Containers</div>
    <div id="row-as">Applied Shipping</div>
    <div id="row-bt">Burlington Textiles</div>
    </div>
    Which statement adds the priority-account CSS class to the Applied Shipping row?