公司别人写的代码:
function XMLHttpRequestCaller(_caller, serviceName, methodName, async, method, needCheckLogin, actionUrl) {
if((!serviceName || !methodName) && !actionUrl){
alert("AJAX Service name or method, actionUrl is not null.");
throw new Error(3, "AJAX Service name or method is not null.");
}
this.params = new AjaxParameter();
this.serviceName = serviceName;
this.methodName = methodName;
this.needCheckLogin = needCheckLogin == null ? "true" : needCheckLogin;
this.returnValueType = "XML"; //XML TEXT
this.method = method || AJAX_XMLHttpRequest_DEFAULT_METHOD;
this.async = (async == null ? AJAX_XMLHttpRequest_DEFAULT_async : async);
this._caller = _caller;
this.actionUrl = actionUrl;
this.filterLogoutMessage = true;
this.closeConnection = false;
};
这个类有7个参数,但在用到的地方调用这个类时,他们却只写了4个参数,为什么这样能行得通,我是学Java的,Java中是不可以,所以我不能理解。
function savePrintCount() {
var requestCaller = new XMLHttpRequestCaller(this, "czxzfManager", "save", false);
requestCaller.addParameter(1, "String", summaryId);
requestCaller.serviceRequest();
}
求大神指点,为什么参数不完整也能正常