Array.prototype.max = function(){
var max = 0
for(var i=0;i<this.length;i++){
if(max<this[i]){
max = this[i]
}
}
return max
}
var arr = [1,2,5,3,2,4]
console.log(arr.max())
5
原文地址:http://blog.51cto.com/12173069/2092766
时间: 2024-10-02 15:13:36