取得数组中最大的值

来源:互联网 发布:dnf一直网络中断 编辑:程序博客网 时间:2024/05/17 06:23
  1. 找到数组中的最大值;
     var arr = [3,5,6,2,8];
     var res = Math.max.apply(Math,arr);
     var res2 = Math.min.apply(Math,arr);
     console.log(res);  //8
     console.log(res2);//2
原创粉丝点击