Error Handling Quiz
Multiple Choice Medium
Question
In a try/catch/finally block, when does the finally block run?
Hint
finally runs regardless of what happens in try.
Explanation
The finally block always executes, whether an error was thrown and caught, no error occurred, or even if return is called in try or catch. This makes it ideal for cleanup code (closing files, releasing resources). The only exception is if the process is terminated (e.g., process.exit()).
Related Resources
Related Lessons
- JavaScript Functions
Learn about try/catch/finally.
Look up unfamiliar terms
A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.
Build real projects
Apply what you learned by building guided projects with starter code and solutions.