JavaScript-Developer-I Exam Question 31

Refer to the code below:

What is the output of this function when called with an empty array?
  • JavaScript-Developer-I Exam Question 32

    A developer wants to set up a secure web server with Node.js. The developer creates a directory locally called app-server, and the first file is app-server/index.js Without using any third-party libraries, what should the developer add to index.js to create the secure web server?
  • JavaScript-Developer-I Exam Question 33

    Refer to the code below:

    What is the value of result after line 10 executes?
  • JavaScript-Developer-I Exam Question 34

    Refer to the following array:
    Let arr1 = [ 1, 2, 3, 4, 5 ];

    Which two lines of code result in a second array, arr2 being created such that arr2 is not a reference to arr1?
  • JavaScript-Developer-I Exam Question 35

    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?