Async function
An async function is a function whose result is represented by an asynchronous computation, allowing execution to suspend while asynchronous operations complete.
Secrets of the JavaScript Ninja, Second Edition
A JavaScript function marked as asynchronous that can use await and returns a promise.
- How it is used
- Uses async functions to sequence dependent asynchronous tasks without blocking the UI.
- How deep it goes
- Explains async and await syntax and their role in coordinating promises, while leaving the underlying machinery out of the code.
- Examples
- Demonstrates sequential JSON requests for ninja, mission, and mission-detail data, with try/catch error handling.
- What you can do after
- Apply async/await to sequence dependent requests without blocking and handle failures with try/catch.
Read how Secrets of the JavaScript Ninja, Second Edition explains async function →
Secrets of the JavaScript Ninja, Third Edition
The async keyword marks a function whose return value is wrapped in a promise and whose thrown errors reject that promise.
- How it is used
- Produces promises without explicit construction, enabling functions to participate in promise-based workflows.
- How deep it goes
- Defines value resolution and error rejection, then demonstrates their use in a fetch-and-parse workflow.
- Examples
- Uses a function returning a string and a fetchJson request that checks response status before parsing JSON.
- What you can do after
- Apply async functions to return promise results and turn thrown errors into promise rejections.
Read how Secrets of the JavaScript Ninja, Third Edition explains async function →
Building LLM Applications with DSPy
The Python async keyword declares a coroutine function that can use await expressions.
- How it is used
- Uses coroutine functions to let I/O-bound tasks yield while remote services respond.
- How deep it goes
- Defines async def and explains cooperative pausing, but does not detail coroutine implementation internals.
- Examples
- Demonstrates two coroutine functions waiting for different durations and returning results through asyncio.gather.
- What you can do after
- Build coroutine functions with async def for tasks that can pause during I/O waits.
Read how Building LLM Applications with DSPy explains async function →
What to know first
- arrow functionAn arrow function is a JavaScript function expression written with arrow syntax that uses lexical binding for this and has no own arguments object.
- asynchronous programmingAsynchronous programming structures operations so that the initiating execution can continue or yield control without synchronously waiting for each operation to complete.
- threadA thread is a distinct sequence of execution with its own control flow and state, managed or scheduled by a processor, runtime, or operating system.
- functionA function is a callable unit of program code that performs a computation or operation, can accept inputs, and may produce a result or side effect.
Related concepts
- awaituses · The C# keyword that suspends an asynchronous method until an awaited operation completes, without blocking the current thread.
- promiseproduces · A JavaScript Promise is an object representing the eventual completion or failure of an asynchronous operation and its resulting value or reason.
- async/awaitconfigured by · Async/await is language syntax for defining asynchronous computations that can suspend at awaited operations and resume when those operations produce results.
- coroutineimplements · A coroutine is a computation that can suspend and later resume execution while retaining its state, enabling cooperative transfer of control.
- ECMAScript language specificationpart of · The ECMAScript language specification is the formal standard defining the syntax, semantics, and built-in behavior of the ECMAScript programming language.
Questions about async function
What is async function?
An async function is a function whose result is represented by an asynchronous computation, allowing execution to suspend while asynchronous operations complete.
Which Manning books explain async function?
Secrets of the JavaScript Ninja, Second Edition, Secrets of the JavaScript Ninja, Third Edition and Building LLM Applications with DSPy.
What should I know before learning async function?
Manning books that teach async function usually introduce arrow function, asynchronous programming, thread and function first.
What is async function part of?
Async function is part of ECMAScript language specification. The ECMAScript language specification is the formal standard defining the syntax, semantics, and built-in behavior of the ECMAScript programming language.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.


