javascript-tutorial / javascript-tutorial/en.javascript.info

await async

Open
#3,567 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
HTML
Stars
25.5k
Forks
4k
PR merge metrics
No merged PRs in 30d

Description

In https://javascript.info/async-await it states

Let’s emphasize: await literally suspends the function execution until the promise settles, and then resumes it with the promise result. That doesn’t cost any CPU resources, because the JavaScript engine can do other jobs in the meantime: execute other scripts, handle events, etc.

This is not clear enough. It must clarify that it just suspends the async function in which the await resides. It doesn't suspend the outer method if that doesn't await.

Therefore note that in this example "start 1" and "start 2" are logged before the resolution is logged.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the async/await article at javascript.info/async-await and review the section explaining await suspension. Clarify that only the containing async function is suspended, then incorporate the linked example's observed logging order. Done means the explanation accurately distinguishes the async function from its outer caller.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.