数组排序于数组去重

数组去重

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
})
希望自己写的东西能够对大家有所帮助!谢谢
原文地址:https://www.cnblogs.com/mrxinxin/p/10373730.html