---
source: https://iinventedlight.com/library/notes/javascript-async-await.md
title: "Async functions: writing promise code in a direct style"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "CC-BY-4.0 (web.dev); CC-BY-4.0 (WHATWG); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "Summary by iinventedlight (AI-assisted). Sources: web.dev, Async functions: Making promises friendly; WHATWG, HTML Living Standard, Web application APIs. CC-BY-4.0 (https://web.dev/learn/css/flexbox). Copyright Google LLC. web.dev text is CC BY 4.0. CC-BY-4.0 (https://raw.githubusercontent.com/whatwg/html/main/LICENSE). Copyright WHATWG contributors."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-23
status: published
approved_by: "Cole Withington, 2026-11-27 14:30 PT: \"Yes, publish all of that now\""
checked_on: 2026-11-23
as_of: 2026-11-23
confidence: medium
untested: "Not reproduced (2026-11-23). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coding-references
topic_area: "code-web: javascript-async-await"
tags: [javascript, async, await, promises, web]
client: Librarian
sources:
  - id: S1
    title: "Async functions: Making promises friendly"
    publisher: web.dev
    url: https://web.dev/articles/async-functions
    accessed: 2026-11-23
    license: "CC-BY-4.0"
  - id: S2
    title: "HTML Living Standard, Web application APIs"
    publisher: WHATWG
    url: https://html.spec.whatwg.org/multipage/webappapis.html
    accessed: 2026-11-23
    license: "CC-BY-4.0"
---
# Async functions: writing promise code in a direct style
**Answer:** An async function lets you write promise-based code in a direct style. await waits for settlement without blocking the main thread.

## How await works

web.dev describes async functions as a friendlier way to write promise-based code, almost as if the code were synchronous, without blocking the main thread.

Use the async keyword before a function definition, then use await within the function.

await pauses that function in a non-blocking way until the promise settles.

A fulfilled promise gives you the value. A rejection throws the rejected value.

## Return values and rejections

Async functions always return a promise, whether you use await or not.

The returned promise fulfills with the function's return value, or rejects with a thrown value.

HTML still tracks unhandled promise rejections. A rejection that is not handled can remain in the outstanding rejected promises weak set.

## See also

- [javascript-promises](https://iinventedlight.com/library/notes/javascript-promises/)

## Claims

- id: C1
  claim: Async functions let you write promise-based code as if it were synchronous.
  source: S1
  evidence: "write promise-based code as if it were synchronous"

- id: C2
  claim: await pauses the function until the promise settles, without blocking.
  source: S1
  evidence: "paused in a non-blocking way until the promise settles"

- id: C3
  claim: An async function always returns a promise.
  source: S1
  evidence: "Async functions always return a promise"

- id: C4
  claim: HTML tracks unhandled promise rejections on the global object.
  source: S2
  evidence: "Unhandled promise rejections"

## Sources

- [S1] Async functions: Making promises friendly. web.dev. https://web.dev/articles/async-functions . License: CC-BY-4.0. Accessed 2026-11-23.

- [S2] HTML Living Standard, Web application APIs. WHATWG. https://html.spec.whatwg.org/multipage/webappapis.html . License: CC-BY-4.0. Accessed 2026-11-23.

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: web.dev, Async functions: Making promises friendly; WHATWG, HTML Living Standard, Web application APIs. CC-BY-4.0 (https://web.dev/learn/css/flexbox). Copyright Google LLC. web.dev text is CC BY 4.0. CC-BY-4.0 (https://raw.githubusercontent.com/whatwg/html/main/LICENSE). Copyright WHATWG contributors. Text was condensed and changed from the originals.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
