Login to manage your account

Please enter a valid email address.
Forgot Password?
Please enter a valid password.
OR

Don't have an account yet? Sign up

What is the purpose of the finally block in a try/catch/finally?

  1. A It runs only if no error occurred
  2. B It runs only if an error occurred
  3. C It always runs regardless of whether an error was thrown
  4. D It suppresses all errors
Answer

It always runs regardless of whether an error was thrown

finally is used for cleanup such as closing resources or hiding a loading indicator. It executes even if the try or catch block returns.

All Javascript MCQs

Login to manage your account

Please enter a valid email address.
Forgot Password?
Please enter a valid password.
OR

Don't have an account yet? Sign up as