function ArryDiff(a,b){
return [...a.filter(x => !b.includes(x)),...b.filter(x => !a.includes(x))]
}
const a = [1,2,3,4]
const b = [1,2,3,4,5,6,7,1]
ArryDiff(a,b) //[5, 6, 7]
js找出数组的差异
最新推荐文章于 2023-02-20 17:57:14 发布
function ArryDiff(a,b){
return [...a.filter(x => !b.includes(x)),...b.filter(x => !a.includes(x))]
}
const a = [1,2,3,4]
const b = [1,2,3,4,5,6,7,1]
ArryDiff(a,b) //[5, 6, 7]