JSFiddle - React, Tailwind, and code Playground

by Anton Spirin

JavaScript

const foo = () => {
  try {
    bar();
  } catch (e) {
    alert('foo catch: ' + e.message);
  }
};

const bar = () => {
  try {
    JSON.parse('invalid JSON');
  } catch (e) {
     alert('bar catch: ' + e.message);
  }
}

try {
  foo();
} catch (e) {
   alert('outer catch: ' + e.message);
}