Question · JavaScript and TypeScript course · Module 4: Asynchronous JavaScript

try/catch with async/await

How do you handle an error in an async function?

Answer options

  • By using only .catch() on the result
  • Async automatically handles errors
  • By using a try/catch block inside the async function
  • Errors in async cannot be handled

You can check the correct answer by solving this task in the CodeWorlds game.