数组过滤重复元素

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);

猜你喜欢

转载自www.cnblogs.com/lishidefengchen/p/9230097.html