Js取数组中最大值和最小值

来源:互联网 发布:域名被墙解决办法 编辑:程序博客网 时间:2024/05/22 02:33
Array.prototype.max = function(){   //最大值 return Math.max.apply({},this) } Array.prototype.min = function(){   //最小值 return Math.min.apply({},this) }[1,2,3].max()// => 3 [1,2,3].min()// => 1

0 0
原创粉丝点击