📜  javascript try - Javascript 代码示例

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

代码示例6
try {

  alert('Start of try runs');  // (1) <--

  lalala; // error, variable is not defined!

  alert('End of try (never reached)');  // (2)

} catch(err) {

  alert(`Error has occurred!`); // (3) <--

}