try{ console.log(0); }catch (err){ console.log(1); console.log(hello); }finally { console.log(2); } //最后结果分别打印出 0 2 /* try{ a.b.c(); }catch (e){ console.log(1); console.log(hello); }finally { console.log(2); } */ //最后结果分别打印出 1 2 报错:hello is not defined /* try{ a.b.c(); }catch (e){ console.log(1); try{ console.log(hello); }catch (e){ console.log(3); } }finally { console.log(2); console.log(word); } */ //最后结果分别打印出 1 3 2 报错:word is not defined /* try{ a.b.c(); }catch (e){ console.log(1); console.log(hello); }finally { console.log(2); console.log(word); }*/ //最后结果分别打印出 1 2 报错:word is not defined
以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,同时也希望多多支持!