Question 41

Refer to the code below:

Line 05 causes an error. What are the values of greeting and salutation once code completes?
  • Question 42

    Given the following code:
    document.body.addEventListener(' click ', (event) => {
    if (/* CODE REPLACEMENT HERE */) {
    console.log('button clicked!');
    )
    });
    Which replacement for the conditional statement on line 02 allows a developer to correctly determine that a button on page is clicked?
  • Question 43

    Refer to the code below:
    Let car1 = new Promise((_ , reject) =>
    setTimeout(reject, 2000, "car 1 crashed in" =>
    Let car2 =new Promise(resolve => setTimeout(resolve, 1500, "car 2 completed") Let car3 =new Promise(resolve =>setTimeout(resolve, 3000, "car 3 completed") Promise.race(( car1, car2, car3))
    .then (value => (
    Let result = '$(value) the race.';)}
    .catch(arr => {
    console.log("Race is cancelled.", err);
    });
    What is the value of result when Promise.race executes?
  • Question 44

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

    Refer to the code below:
    01 let timedFunction = () => {
    02 console.log('Timer called.');
    03 };
    04
    05 let timerId = setInterval(timedFunction, 1000);
    Which statement allows a developer to cancel the scheduled timed function?