function filterArrayDifference(arr1, arr2) {
let result = [];
for (let i = 0; i < arr1.length; i++) {
let isUnique = true;
for (let j = 0; j < arr2.length; j++) {
if (arr1[i] === arr2[j]) {
isUnique = false;
break;
}
}
if (isUnique) {
result.push(arr1[i]);
}
}
return result;
}
console.log(filterArrayDifference([1,2,2,3], [1])); // output: [2,2,3]
console.log(filterArrayDifference([1,2,2,3], [1,2]); // output: [3]
Attempting to address the issue of unwanted outputs caused by multiple elements in 'arr2' when finding array difference.