慕容3067478
let arr1 = [2, 3, 5, 10];let arr2 = [1, 3, 7, 10];console.log( '并集', [...new Set([...arr1, ...arr2])] ); // [2, 3, 5, 10, 1, 7]console.log( '交集', arr1.filter(a => (arr2.indexOf(a) !== -1)) ); // [3, 10]console.log( '差集', arr1.filter(a => (arr2.indexOf(a) === -1)) ); // [2, 5]