数组去重
function uniq(array){ var temp = []; //一个新的临时数组 for(var i = 0; i < array.length; i++){ if(temp.indexOf(array[i]) == -1){ temp.push(array[i]); } } return temp; } var aa = [1,2,2,4,9,6,7,5,2,3,5,6,5]; console.log(uniq(aa));</script>
数组排序
arr.sort((a,b)=>{ return a-b })