SpinTheMic
Pro

Interview practice question

An async function returns a Promise instead of the value

Frontend Engineering · Async JavaScript and the Browser · Beginner

Your code logs "Promise {<pending>}" instead of the data from an async function. Why, and how do you fix it?

What a strong answer covers

Your AI report card counts how many of these ideas you cover.

  • Async functions always return promises.
  • Need await or .then.
  • Calling code must be async too.
  • Top-level await in modules.
  • Don't mix sync expectations.
Practise this topic

Start without signing up. Sign in free to get an AI report card on your answer.

See all topics