Question 11

Refer to the code below:
Async funct on functionUnderTest(isOK) {
If (isOK) return 'OK' ;
Throw new Error('not OK');
)
Which assertion accurately tests the above code?
  • Question 12

    Cloud Kicks has a class to represent items for sale in an online store, as shown below:
    Class Item{
    constructor (name, price){
    this.name = name;
    this.price = price;
    }
    formattedPrice(){
    return 's' + String(this.price);}}
    A new business requirement comes in that requests a ClothingItem class that should have all of the properties and methods of the Item class but will also have properties that are specific to clothes.
    Which line of code properly declares the clothingItem class such that it inherits from Item?
  • Question 13

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

    A developer wants to use a try...catch statement to catch any error that countSheep () may throw and pass it to a handleError () function.
    What is the correct implementation of the try...catch?
    A)

    B)

    C)

    D)
  • Question 15

    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?