Search⌘ K

What Makes Async Functions Different?

Explore the key differences that set async functions apart from synchronous functions in JavaScript. Understand how async functions always return promises, handle thrown errors as promise rejections, and enable the use of await expressions and for-await-of loops for effective asynchronous programming.

Async functions are different from synchronous functions in four ways:

  • The return value is always a promise.
  • Thrown errors are promise rejections.
  • The await expression can be used.
  • The for-await-of loop can be used.

These four aspects of async functions make them quite different from synchronous ones, so it’s worth going through each point in more detail.

The return value is always a promise

We can use the return operator in async functions ...