tmp[i];
}
console.log(max);
使用apply方法:
var a = [1,2,3,5];
console.log(Math.max.apply(null, a));//最大值...console.log(Math.min.apply(null, a));//最小值
多维数组可以这么修改:
var a = [1,2,3,[5,6],[1,4,8]];
var ta = a.join...(",").split(",");//转化为一维数组
console.log(Math.max.apply(null, ta));//最大值
console.log(Math.min.apply(null