CodePeek
Practice / AsyncBack to CodePeek

JavaScript await: Pause, not stop

Puzzle 15 of 15 · await

Follow an async function through await and a console log in its caller. Predict the order of the logs as execution pauses and resumes. Choose an output below, then check the explanation. No signup needed. Browse puzzles by topic →

Async / awaitJavaScript
async function peek() {
  console.log("A");
  await Promise.resolve();
  console.log("B");
}
peek();
console.log("C");

Predict the console output. Each line is a separate log.

What’s the output?

Choose the output

Starter puzzles 15