Dev Helpers

JavaScript / Async

Await a resolved value

Dev Helpers · February 7, 2026

Awaiting an already fulfilled promise still yields control to the microtask queue. That matters when debugging the order of UI updates.

Worked example

const read = async () => ({ id: 7 });
console.log(await read());

Result

{ id: 7 }

Implementation notes

Returning the promise and awaiting it inside a try block can expose different error-handling boundaries. Place the await where that operation's failure is meant to be handled.

Try it yourself

Log immediately before the await, after it, and after calling the function.

Open the JavaScript example →

Editorial date February 7, 2026 · Published December 6, 2026

Related articles

Sum distances with a Euclidean norm

A diagonal is longer than either of its components. Math.hypot combines perpendicular distances without making the caller square each input.

Build an OS-independent path

Path conventions belong to the destination. Use an explicit path flavour when generating portable asset names.

Resolve ranked ties

A leaderboard needs an explicit tie policy. Ranking tied scores and sorting their display order are separate decisions.