</> realdeveloper

Asynchronous JavaScript and await

Asynchronous work lets the program do other work while waiting. A Promise represents a future outcome. await suspends the continuation of its async function, not the entire application.

A concrete example

Show loading, success and failure states separately for a network request. Independent requests can be awaited together; dependent requests must remain sequential.

const [user, tasks] = await Promise.all([loadUser(), loadTasks()]);

Explain it yourself

How do you clear a loading indicator when a Promise rejects?

How to study this

Write your reasoning first. Check the original documentation, identify an assumption, then try a different example. Reading this page does not count as verified skill evidence.

Source and review

MDN asynchronous JavaScript ↗

Original RealDeveloper explanation; last source check: .

Put it into practice

Public pages are open to everyone. Sign in to save answers and follow a personal practice route.

Open practice topics →