Question 36

At Universal Containers, every team has its own way of copying JavaScript objects. The code snippet shows an implementation from one team:

What is the output of the code execution?
  • Question 37

    Universal Containers (UC) just launched a new landing page, but users complain that the website is slow. A developer found some functions any that might cause this problem. To verify this, the developer decides to execute everything and log the time each of these three suspicious functions consumes.
    Which function can the developer use to obtain the time spent by every one of the three functions?
  • Question 38

    Refer to the code below:
    function foo () {
    const a =2;
    function bat() {
    console.log(a);
    }
    return bar;
    }
    Why does the function bar have access to variable a ?
  • Question 39

    A test has a dependency on database .query. During the test the dependency is replace with an 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?
  • Question 40

    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?