求数组中的最大最小值

var a=[1,2,3,5];
alert(Math.max.apply(null, a));//最大值
alert(Math.min.apply(null, a));//最小值
posted @ 2018-05-17 21:02  梓色心晴  Views(168)  Comments(0Edit  收藏  举报