📜  javascript try catch finally return - Javascript代码示例

📅  最后修改于: 2022-03-11 15:02:26.246000             🧑  作者: Mango

代码示例1
(function() {
  try {
    try {
      throw new Error('oops');
    } catch (ex) {
      console.error('inner', ex.message);
      throw ex;
    } finally {
      console.log('finally');
      return;
    }
  } catch (ex) {
    console.error('outer', ex.message);
  }
})();

// Output:
// "inner" "oops"
// "finally"