菜鳥一枚,感謝各位:高程3上說“只要代碼中包含 finally 子句,那么無論 try 還是 catch 語句塊 中的 return 語句都將被忽略。”但是我做的一個測試出現(xiàn)了這樣的結(jié)果:var example = function() { try { window.someNonexistentFunction();
} catch (error) { console.log(error.name); console.log(error.message); return 1;
} finally { console.log('everything is over');
}
};
example();Firebug中的輸出:最后為什么會輸出1?
catch子句的語句為什么在finally子句執(zhí)行完成又執(zhí)行?
qq_遁去的一_1
2018-09-04 13:18:21