mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-06 12:03:34 -04:00
fix(curriculum): clarify async/await explanation in lecture content (#66935)
This commit is contained in:
committed by
GitHub
parent
526e09bbf0
commit
dabb661d06
@@ -9,7 +9,7 @@ dashedName: what-is-async-await-and-how-does-it-work
|
||||
|
||||
In the previous lessons, you learned about asynchronous programming which allows other code to run while we wait for some time-consuming tasks to complete, like fetching data from a server, reading data from a file, and so on.
|
||||
|
||||
`async`/`await`, built on top of promises, makes writing and reading asynchronous code easier. When you put the `async` keyword before a function, it means that function will always return a `Promise`. Only inside an `async` function, you can use the `await` keyword, which allows you to wait for a `Promise` to resolve before moving on to the next line of code. Here's an example to illustrate how `async`/`await` works:
|
||||
`async`/`await`, built on top of promises, makes writing and reading asynchronous code easier. When you put the `async` keyword before a function, it means that function will always return a `Promise`. The `await` keyword, which allows you to wait for a `Promise` to resolve before moving on to the next line of code, can only be used inside of asynchronous functions or the top level bodies of modules. Here's an example to illustrate how `async`/`await` works:
|
||||
|
||||
:::interactive_editor
|
||||
|
||||
|
||||
Reference in New Issue
Block a user