Put in order · JavaScript and TypeScript course · Module 2: Functions, Arrays and Objects

Error Basics - Handling Order

Arrange the stages of error handling in JavaScript from the moment the problem occurs:

Items to put in order

  • The program continues execution after the try/catch/finally block
  • Code in the try block encounters an error
  • The catch block handles the error (logging, recovery)
  • The finally block performs cleanup operations (resource cleanup)
  • Execution passes to the catch block with the error object
Show the answer

Correct order:

  1. Code in the try block encounters an error
  2. Execution passes to the catch block with the error object
  3. The catch block handles the error (logging, recovery)
  4. The finally block performs cleanup operations (resource cleanup)
  5. The program continues execution after the try/catch/finally block