js 两个数组对比,去除相同项得到新数组

var arr1 = [a, b, c,];
var arr2 = [a, b, c, d];
let list = arr2.filter(items => {
  if (!arr1.includes(items)) return items;
})
console.log(list);
发布了25 篇原创文章 · 获赞 11 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/weixin_40425415/article/details/103855575