module.exports = function(arr1, arr2) { if(arr1.length===0||arr2.length===0||arr1.length!==arr2.length){ return "参数错误"; } var arr1Temp = arr1.sort(); var arr2Temp = arr2.sort(); var num = 0; for(var i =0,j=arr1.length-1;i<arr1.length;i++,j--){ num += arr1[i]*arr2[j]; } console.log(num); return num; }