标签:去重 app style 最大 color OLE return fun 最小值
function random(min, max) {
if (arguments.length === 2) {
return Math.floor(min + Math.random() * ((max + 1) - min))
} else {
return null;
}
}
console.log(random(10,20));
function unique(arr){
if (Array.hasOwnProperty(‘from‘)) {
return Array.from(new Set(arr));
} else {
var n = {}, r = [];
for (var i = 0; i < arr.length; i++) {
if (!n[arr[i]]) {
n[arr[i]] = true;
r.push(arr[i]);
}
}
return r;
}
}
var arr = [1,2,3,1,2,3,4];
console.log(unique(arr));
function max(arr) { return Math.max.apply(null,arr1) } var arr = [1,2,3,4,1,2,3,4]; console.log(max(arr));
function min(arr) {
return Math.min.apply(null,arr1)
}
var arr = [1,2,3,4,1,2,3,4];
console.log(min(arr));
(更新中...)
标签:去重 app style 最大 color OLE return fun 最小值
原文地址:https://www.cnblogs.com/ssjd/p/13024070.html