Skip to main content

What happens if you don't use await?

The key idea

If you don't use await, then instead of the result you get the Promise itself, a promise that will settle eventually, but hasn't yet.

Without await you don't "wait" for the result, you just create a promise and move on.


Example 1: without await, a promise is returned

javascript
async function getData() { return 'Data'; } async function main() { const result = getData(); // without await console.log(result); } main();

Output:

javascript
Promise { 'Data' }

Why:

  • getData() is an async function, so it always returns a promise;
  • without await you get a Promise object, not 'Data'.

Example 2: with await

javascript
async function main() { const result = await getData(); // waited for it console.log(result); } main();

Output:

javascript
Data

await "unwraps" the promise, returning its value.


Example 3: forgot await, and the code moved on

javascript
async function delay() { await new Promise(res => setTimeout(res, 2000)); console.log('Done after 2 sec'); } async function run() { delay(); // not waiting! console.log('Moving on'); } run();

Output:

javascript
Moving on Done after 2 sec

Without await, execution doesn't pause, the delay() function runs in the background, while the program continues.


Example 4: missing await gives the wrong result

javascript
async function fetchUser() { return { name: 'Alex' }; } async function showUser() { const user = fetchUser(); // forgot await console.log('User name:', user.name); } showUser();

Output:

javascript
User name: undefined

Because user is not an object, it's a Promise, which has no name field. That is, this is a logic error, not a syntax error.


Example 5: when you deliberately don't use await (parallel tasks)

Sometimes not using await is correct, if you want operations to run in parallel:

javascript
async function load() { const userPromise = fetch('/api/user'); const postsPromise = fetch('/api/posts'); // wait for both in parallel const [user, posts] = await Promise.all([userPromise, postsPromise]); console.log('Both responses received'); }

If you put await right after each fetch, they would run one after another, not at the same time.


Example 6: await on a return

javascript
async function foo() { return await Promise.resolve('OK'); }

await here is redundant, you can just write:

javascript
async function foo() { return Promise.resolve('OK'); }

Because an async function wraps the result in a promise anyway.


Under the hood (what actually happens)

When you call an async function:

javascript
const p = myAsyncFunction();

JavaScript immediately returns a Promise object, while the code inside starts executing asynchronously. If you don't use await, that promise simply stays "in the air", and you never use the result of its execution.


Common problems without await

MistakeWhat happens
Forgetting await when calling an async functionThe variable ends up with a Promise, not the result
Returning without await inside another async functionMay return an "unfinished" promise
Inconsistent dataThe code moves on while the promise hasn't resolved yet
Errors aren't caughttry...catch won't catch a reject if you didn't await it

A simple analogy

Imagine await is "waiting for your order"

  • With await: you stand at the counter, wait for the coffee, and get the cup.
  • Without await: you just place the order and walk away, the coffee gets made, but you never pick it up.

SUMMARY

ScenarioWhat happens
Didn't use awaitThe function returns a Promise, execution continues right away
Used awaitExecution pauses until the promise settles
An error without awaittry...catch won't catch it, the promise wasn't "awaited"
When to skip awaitWhen launching parallel tasks (Promise.all)

Short Answer

Interview ready
Premium

A concise answer to help you respond confidently on this topic during an interview.