I have 2 arrays and a method that finds differences.
But at the moment, the method shows the result of the difference between both arrays.
How to implement comparisons of the first array with the second so that only the differences of the first array are returned.
let test1 = ['1', '2', '3', '4/2', '5/4', '6-2'];
let test2 = ['1', '2', '3', '5/4', '4/2', '6-1', '7/2', '8-2'];
const diff = function (arr1, arr2) {
return arr1.filter(i => !arr2.includes(i)).concat(arr2.filter(i => !arr1.includes(i)))
}
console.log(diff(test1, test2));
Expected to return a value: 6-2