...

/

What Makes Async Functions Different?

What Makes Async Functions Different?

Distinguish between asynchronous and synchronous functions.

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 ...