Loading... ``` https://blog.csdn.net/dongcehao/article/details/106320307 个人理解 ● try catch中try和finally的return可以取代函数的return // 失败 function foo() { try { var sum = 10; sum.push(10); console.log('成功'); return '成功' } catch (e) { console.log('失败') return '失败' } finally { console.log('最终'); return '最终' } return '函数返回'; } const str = foo(); console.log(str); /* 打印结果 '失败' '最终' '最终' */ ``` 最后修改:2022 年 05 月 16 日 © 允许规范转载 打赏 赞赏作者 赞 0 如果觉得我的文章对你有用,请随意赞赏
1 条评论
文章中的实用建议和操作指南,让读者受益匪浅,值得珍藏。