JavaScript-Developer-I Exam Question 21

Refer to the code below:
<html lang="en">
<table onclick="console.log(Table log');">
<tr id="row1">
<td>Click me!</td>
</tr>
<table>
<script>
function printMessage(event) {
console.log('Row log');
}
Let elem = document.getElementById('row1');
elem.addEventListener('click', printMessage, false);
</script>
</html>
Which code change should be made for the console to log only Row log when 'Click me! ' is clicked?
  • JavaScript-Developer-I Exam Question 22

    A test has a dependency on database.query. During the test the dependency is replaced with an object called database with the method, query, that returns an array. The developer needs to verify how many times the method was called and the arguments used each time.
    Which two test approaches describe the requirement?
    Choose 2 answers
  • JavaScript-Developer-I Exam Question 23

    Which two console logs outputs NaN ?
    Choose 2 answers
  • JavaScript-Developer-I Exam Question 24

    Refer to the code below:
    for(let number =2 ; number <= 5 ; number += 1 ) {
    // insert code statement here
    }
    The developer needs to insert a code statement in the location shown. The code statement has these requirements:
    1. Does require an import
    2. Logs an error when the boolean statement evaluates to false
    3. Works in both the browser and Node.js
    Which meet the requirements?
  • JavaScript-Developer-I Exam Question 25

    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