数组去重最优解:Array.prototype.unique = function () {var tmp = new Map();return this.filter(item => {return !tmp.has(item) && tmp.set(item,1);})}
搭配使用
Array.from('foo');
// ["f", "o", "o"]let s = new Set(['foo', window]);
Array.from(s);
// ["foo", window]let m = new Map([[1, 2], [2, 4], [4, 8]]);
Array.from(m);
// [[1, 2], [2, 4], [4, 8]]Array.from([1, 2, 3], x => x + x);
// [2, 4, 6]去重
function combine(){ let arr = [].concat.apply([], arguments); //没有去重复的新数组 return Array.from(new Set(arr));
} var m = [1, 2, 2], n = [2,3,3];
console.log(combine(m,n));