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?
Correct Answer:
C
A Developer wrote the following code to test a sum3 function that takes in an array of numbers and returns the sum of the first three number in the array, The test passes:
A different developer made changes to the behavior of sum3 to instead sum all of the numbers present in the array. The test passes:
Which two results occur when running the test on the updated sum3 function ? Choose 2 answers
Correct Answer:
AD
Which statement accurately describes an aspect of promises?
Correct Answer:
A
Refer to the code snippet below: Let array = [1, 2, 3, 4, 4, 5, 4, 4];
For (let i =0; i < array xss=removed>array.splice(i, 1);
}
}
What is the value of array after the code executes?
Correct Answer:
B
A developer wants to leverage a module to print a price in pretty format, and has imported a method as shown below:
Import printPrice from‘/path/PricePrettyPrint.js’;
Based on the code, what must be true about the printPrice function of the PricePrettyPrint module for this import to work ?
Correct Answer:
C