The*_*awk 2 javascript try-catch
是否可以将函数包装在 try-catch 块中?它似乎不适用于第一个函数,但它适用于以这种方式声明的原型函数吗?
例子:
try {
function MyFunction1() {
//function code here
}
MyFunction1.prototype.getValue = function() {
//more code here
}
} catch (e) {
//error handling here
}
Run Code Online (Sandbox Code Playgroud)