Skip to content
KALANBLON
Show contents

Chapter 3 of 6 · 10 min

Quiz: asynchronous code

Event loop, promises, async/await and fetch: let's check that your code waits for the right thing at the right time. You need 70% correct answers.

Quiz

6 questions · pass mark: 70%

  1. 1.In what order are the letters displayed?

    One answer

    setTimeout(() => console.log("A"), 0);
    Promise.resolve().then(() => console.log("B"));
    console.log("C");
  2. 2.What does a function declared with async always return?

    One answer

  3. 3.The server answers 404. What does the promise returned by fetch do?

    One answer

  4. 4.Complete to wait for three requests started in parallel.

    Complete the code

    const [a, b, c] = await Promise.____([loadA(), loadB(), loadC()]);
  5. 5.Which statements are true? (several answers)

    Several answers possible

  6. 6.Why reject a promise with new Error("…") rather than a plain string?

    One answer

Your progress is saved on this device. Create a free account to keep your progress on all your devices.