数组过滤重复元素

var source_arr = ['a', 'b', 'a', 'c', 'a', 'd', '1',1,'1'];
var array_unique = source_arr.filter(function (element, index, array) {
    return array.indexOf(element) === index;
});
console.log(array_unique);
console.log(source_arr);

 

posted @ 2018-06-26 17:10  lishidefengchen  阅读(772)  评论(0编辑  收藏  举报