- ,取最大值
- var arr = [1,3,7,22,677,-1,2,70];
- Math.max.apply(Math, arr);//677
- Math.max.call(Math, 1,3,7,22,677,-1,2,70);//677
- 2,取最小值
- var arr = [1,3,7,22,677,-1,2,70];
- Math.min.apply(Math, arr);//-1
- 可以换成this
- document.write(Math.max.apply(this, arr));//677
document.write("<br/>")
document.write(Math.max.apply(Math, arr));//677
- Math.min.call(Math, 1,3,7,22,677,-1,2,70);//-1
时间: 2024-10-13 08:00:13