Question 121

Refer to the code below:
let car1 = new Promise((_ ,reject)=> setTimeout(reject,2000,"Car1 crashed in")); let car2 = new Promise(resolve => setTimeout(resolve,1500,"Car2 completed")); let car3 = new Promise(resolve => setTimeout(resolve,3000,"Car3 completed")); Promise.race([car1,car2,car3])
.then(value=>{
let result = `${value} the race.`;
}).catch(err=>{
console.log('Race is cancelled.',err);
});
What is the value of result when promise.race execues?
  • Question 122

    Refer to the code below:

    In which sequence will the number be logged?
  • Question 123

    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 ?
  • Question 124

    Refer to the following code that imports a module named utils:
    import (foo, bar) from '/path/Utils.js';
    foo() ;
    bar() ;
    Which two implementations of Utils.js export foo and bar such that the code above runs without error?
    Choose 2 answers
  • Question 125

    A developer is setting up a Node,js server and is creating a script at the root of the source code, index,js, that will start the server when executed. The developer declares a variable that needs the folder location that the code executes from.
    Which global variable can be used in the script?