Question 26

Refer to the code below:

What is the output if this function when called with an empty array?
  • Question 27

    Refer to the code below:
    For (let number =2: number <= S; 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 not require an import
    2. Logs an error when the Boolean statement evaluates to false
    3. Works In both the browser and Node.js
    Which statement meet these requirements?
  • Question 28

    A developer is required to write a function that calculates the sum of elements in an array but is getting undefined every time the code is executed. The developer needs to find what is missing in the code below.

    Which option makes the code work as expected?
  • Question 29

    A developer creates a simple webpage with an input field. When a user enters text in the input field and clicks the button, the actual value of the field must be displayed in the console.
    Here is the HTML file content:
    <input type =" text" value="Hello" name ="input">
    <button type ="button" >Display </button> The developer wrote the javascript code below:
    Const button = document.querySelector('button');
    button.addEvenListener('click', () => (
    Const input = document.querySelector('input');
    console.log(input.getAttribute('value'));
    When the user clicks the button, the output is always "Hello".
    What needs to be done to make this code work as expected?
  • Question 30

    Which two code snippets show working examples of a recursive function?
    Choose 2 answers
    A)

    B)

    C)

    D)