求教一个关于JS返回值得问题
function helpmin1(){
var matchint;
helparrays = inputs.sort();
var sum=parseFloat(0);
for(i=0;i<helparrays.length-1;i++){
sum+=parseFloat(helparrays[i]);
}
var rs=sum/4;
var sd = Math.sqrt(((helparrays[0]-rs)*(helparrays[0]-rs)+(helparrays[1]-rs)*(helparrays[1]-rs)
+(helparrays[2]-rs)*(helparrays[2]-rs)+(helparrays[3]-rs)*(helparrays[3]-rs))/3);
var rsd =(sd/rs*100).toFixed(2);
if(rsd<2){
suggervalue=parseFloat((rs)*1.023);
macthint=parseInt(1);
return macthint;
}else{
helpmax1();
}
}
function helpmin2(){
var matchint;
var sum=parseFloat(0);
for(i=0;i<helparrays.length-2;i++){
sum+=parseFloat(helparrays[i]);
}
var rs=sum/3;
var sd = Math.sqrt(((helparrays[0]-rs)*(helparrays[0]-rs)+(helparrays[1]-rs)*(helparrays[1]-rs)
+(helparrays[2]-rs)*(helparrays[2]-rs))/2);
var rsd =(sd/rs*100).toFixed(2);
if(rsd<2){
suggervalue=(rs)*1.023;
macthint=parseInt(3);
return macthint;
}else{
helpmax2()
}
}
但是貌似2个function 的返回值,无法读取,使用ALERT,是unfinished,求解啊
------解决方案--------------------
function helpmin1() {
var matchint;
helparrays = inputs.sort();
var sum = parseFloat(0);
for (i = 0; i < helparrays.length - 1; i++) {
sum += parseFloat(helparrays[i]);
}
var rs = sum / 4;
var sd = Math.sqrt(((helparrays[0] - rs) * (helparrays[0] - rs) + (helparrays[1] - rs) * (helparrays[1] - rs)
+ (helparrays[2] - rs) * (helparrays[2] - rs) + (helparrays[3] - rs) * (helparrays[3] - rs)) / 3);