Using finally in try…catch in Javascript


Execute code after try and catch, regardless of the result.

Source Code

try {
  console.log('Try block executed');
} catch (error) {
  console.error('Catch block executed');
} finally {
  console.log('Finally block executed');
}
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments