← TechnologyThe essentials of

async and await: readable sequence for asynchronous steps

Publisher: ResumeMaker • 2 sources

Published: 22 Oct 2026 13:13 · Updated: 22 Oct 2026 13:13

AI source check: 20 Oct 2026 22:11. This is not editorial approval.

In a few sentences

In brief

wait waits for a result in the current async function. This syntax makes it easy to read, but does not eliminate the need to define dependencies and error behavior.

Useful to know

Asynchronous code often has to describe several consecutive actions. The async and await syntax allows such actions to be recorded in a form that resembles a simple sequence. A function declared with async, returns Promise, and inside it can be used await. This does not make the network operation immediate. It provides a way for the program to express when the future result is needed and what to do after receiving it. [1]

await operator suspends enclosing asynchronous function until expected Promise. is completed Upon successful execution, the expression gives the resulting value, and upon rejection, the cause is thrown as an exception. [2] Therefore, processing with try and catch is a natural part of many such functions. The useful distinction is between waiting in the specific function and the general behavior of the application. The affixed await is not an instruction for the entire browser to stop working.

Imagine a fictional short-note editor. The user presses "Save", the program sends the content and after a reply displays a confirmation. First you need to determine what exactly the confirmation means. Do we show it after starting the request or after a successful answer? This product question precedes the syntax. When the intention is clear , await can put the next step after the required result, instead of the interface reporting success too early.

A separate question is which operations really depend on each other. If the second action uses the result of the first, the sequential wait has an obvious reason. If two actions are independent, their needs must be addressed separately. The async statement itself does not make this decision for the author. [1] In a learning task, we can record the input and output of each function. Thus, dependencies become visible even before the choice of a specific code organization.

In the event of an error, it should be clear where the interface is being restored. For example, the record button should not be left with an obscure inscription that makes the visitor guess whether the operation is continuing. Three states can be described for the fictional editor: readiness, waiting, and completion. Then a failure scenario is added with an appropriate message. This is not a property of the await, keyword but a part of the completed behavior that the program must provide.

Checking an asynchronous function is most useful when observing the result, not just the order of the lines. Did you get the right data? Is a message displayed after the required event? Is there a meaningful way out of rejection? Thus, async and await remain tools for clear flow expression. They help make the code readable when the author has previously distinguished the dependencies, responsibilities, and expectations of the person using the interface. In an example with an editor, this means explicitly to distinguish the started record from the confirmed record and to check both moments.

Sources

For further detail and to check the information:

  1. [1] MDN — async function ↗
  2. [2] MDN — await ↗