Skip to content

fix: mention top-level module body in async/await lecture#66933

Closed
whatfontisthis wants to merge 1 commit intofreeCodeCamp:mainfrom
whatfontisthis:fix/async-await-top-level-module
Closed

fix: mention top-level module body in async/await lecture#66933
whatfontisthis wants to merge 1 commit intofreeCodeCamp:mainfrom
whatfontisthis:fix/async-await-top-level-module

Conversation

@whatfontisthis
Copy link
Copy Markdown

@whatfontisthis whatfontisthis commented Apr 14, 2026

Checklist:

Closes #66932

Summary

The async/await lecture currently states that await can only be used inside an async function, which is incomplete. Since ES2022, await can also be used at the top level of ES modules (top-level await).

Changes

Lecture prose — updated the key sentence from:

"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."

to:

"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."

Quiz answer — updated the correct answer for question 2 ("Where can the await keyword be used?") from "Inside async functions." to "Inside async functions or at the top level of a module." to match the updated content.

This change was reviewed and approved in the issue thread by @naomi-lgbt.

@github-actions github-actions bot added scope: curriculum Lessons, Challenges, Projects and other Curricular Content in curriculum directory. deprioritized PR reviews are deprioritized; lacks productive input and ignores codebase best practices. labels Apr 14, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Hi there,

Thanks for opening this pull request.

The automated checks found some issues:

Checklist: The PR description is missing the required checklist or some of its items are not completed:

  1. The Checklist: heading is present in the PR description.
  2. The checkbox items are ticked (changed from [ ] to [x]).
  3. You have actually completed the items in the checklist.

Please edit your PR description to include the following template with the checklist items completed.

Checklist:

<!-- Please follow this checklist and put an x in each of the boxes, like this: [x]. It will ensure that our team takes your pull request seriously. -->

- [ ] I have read and followed the [contribution guidelines](https://contribute.freecodecamp.org).
- [ ] I have read and followed the [how to open a pull request guide](https://contribute.freecodecamp.org/how-to-open-a-pull-request/).
- [ ] My pull request targets the `main` branch of freeCodeCamp.
- [ ] I have tested these changes either locally on my machine, or GitHub Codespaces.

<!--If your pull request closes a GitHub issue, replace the XXXXX below with the issue number.-->

Closes #XXXXX

<!-- Feel free to add any additional description of changes below this line -->

Join us in our chat room or our forum if you have any questions or need help with contributing.

@github-actions github-actions bot removed the deprioritized PR reviews are deprioritized; lacks productive input and ignores codebase best practices. label Apr 14, 2026
@camper-chan
Copy link
Copy Markdown

camper-chan bot commented Apr 15, 2026

This PR seems to make similar changes as an existing PR. As such, we are going to close this as a duplicate.

If you feel you have additional changes to expand upon this PR, please feel free to push your commits and request this PR be reopened.

Thanks again! 😊


If you have any questions, feel free to ask questions on the "Contributors" category on our forum or the contributors chat room.

@camper-chan camper-chan bot closed this Apr 15, 2026
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 15, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

scope: curriculum Lessons, Challenges, Projects and other Curricular Content in curriculum directory.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve Async/Await lecture comment about where await is used

1 participant