1、变量写法建议 var i,j for(i =0;i < array1.length;i++){ for(j=0;j < array2.length;j++){ ...... } } 建议双循环或多循环时,将i和j的变量声明在最外部循环前