function diffArray(arr1, arr2) {
const newArr = arr1.concat(arr2);
let difference = newArr.filter(x => newArr.indexOf(x) === newArr.lastIndexOf(x));
return difference;
}
console.log(diffArray([1, 2, 3, 5], [1, 2, 3, 4, 5]));
I managed to solve this problem but I couldn’t do it without looking up certain things on google. I needed a reminder of how to use concat and I needed a reminder that indexOf and lastIndexOf basically indicate where the values start and end in a string. And concat combines two different arrays and makes them one. I already knew how to set up the syntax in the filter method. But is it bad that I needed to search things up in order to complete this solution?