Answers for "when to use finally in javascript"

1

try catch finally in javascript

try { // Try to run this code
  alert( 'try' ); 
  if (confirm('Make an error?')) BAD_CODE();
} catch (e) { // Code throws error
  alert( 'catch' );
} finally { // Always run this code regardless of error or not
  alert( 'finally' );
}
Posted by: Guest on January-26-2021
0

try catch finally in javascript

try {
  alert( 'try' );
  if (confirm('Make an error?')) BAD_CODE();
} catch (e) {
  alert( 'catch' );
} finally {
  alert( 'finally' );
}
Posted by: Guest on December-01-2020

Code answers related to "when to use finally in javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language