我有
function doSomething(callback) {
if (callback.arguments.length == 1) { // Need help here
// Some logic here
callback(obj1);
}
else {
// Some other logic here
callback(obj1, obj2);
}
}
if (someLogic) {
doSomething(function(arg1) { ... });
}
else {
doSomething(function(arg1, arg2) { ... });
}
Run Code Online (Sandbox Code Playgroud)
在调用之前如何检查回调参数的长度?
归档时间: |
|
查看次数: |
1324 次 |
最近记录: |