const arr1 = [1, 2, 3, 4]
const arr2 = [1, 2, 3, 5]
const res = arr2.filter(item1 => !arr1.some(item2 => item2 === item1))
console.log(res); // [5]
arr2 与 arr1相同的元素有 1,2,3 ,res的结果就是 5
const res2 = arr1.filter(item1 => !arr2.some(item2 => item2 === item1))
console.log(res2); // [4]