What is the key behavioral difference between a regular function and an async function when they throw synchronously inside their body?

JavaScript Professional Hard

JavaScript Professional — Hard

What is the key behavioral difference between a regular function and an async function when they throw synchronously inside their body?

Key points

  • Regular functions propagate thrown errors synchronously
  • Async functions wrap thrown errors in rejected Promises
  • Caller must use await or .catch() with async functions
  • Error handling differs between regular and async functions

Ready to go further?

Related questions