JSFiddle - React, Tailwind, and code Playground

by Pankaj Kargirwar

JavaScript

function testFunction() {
  try {
    console.log('In try block');
    throw new Error('An error occurred');
  } catch (error) {
    console.log('In catch block');
    return 'Returning from catch block';
  } finally {
    console.log('In finally block');
  }
}

const result = testFunction();
console.log('Result:', result);