【发布时间】:2013-07-09 22:28:51
【问题描述】:
是否可以将函数包装在 try-catch 块中?它似乎不适用于第一个函数,但它适用于以这种方式声明的原型函数吗?
例子:
try {
function MyFunction1() {
//function code here
}
MyFunction1.prototype.getValue = function() {
//more code here
}
} catch (e) {
//error handling here
}
【问题讨论】:
-
显然不行,我测试了一个脚本,它不起作用
标签: javascript try-catch