双数组去重

230 阅读1分钟
let a1 = ["1", "2", "3", "4", "5", "6", "7", "8", "9"];
let a2 = ["1", "2", "3", "4", "5", "6", "7"]; 
et a3 = [];
a1.forEach((item, index) => {
if (!a2.includes(a1[index])) { a3.push(a1[index]);
} }); 

console.log(a3);