JavaScript · Junior · Question 65 of 75
When does a finally block run?
- ✓Correct answer: Always - after
try/catch, even if there was areturnor an exception - 2Only if no error occurred
- 3Only if an error occurred
Explanation
It is the place for cleanup such as hiding a loader or closing a connection. A return inside finally overrides the earlier return value, so avoid it.