Question 36

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 replace line 01 and declare the function for use?
Choose 2 answers
  • Question 37

    A developer implements and calls the following code when an application state change occurs:
    Const onStateChange =innerPageState) => {
    window.history.pushState(newPageState, ' ', null);
    }
    If the back button is clicked after this method is executed, what can a developer expect?
  • Question 38

    A developer has the function, shown below, that is called when a page loads.
    function onload() {
    console.log("Page has loaded!");
    }
    Where can the developer see the log statement after loading the page in the browser?
  • Question 39

    Given the following code:
    Let x =('15' + 10)*2;
    What is the value of a?
  • Question 40

    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.'?