Tell us what’s happening:
Your code so far
function destroyer(arr) {
let qwe = Array.from(arguments).slice(1);
return arr.concat(qwe).filter(wer => !qwe.includes(wer));
}
destroyer([1, 2, 3, 1, 2, 3], 2, 3);
Why concat() doesn't work? if they are two different arrays ([1,2,3,1,2,3],[2,3]) now.
How filter() works here if both of the array are not concatenated()?
But the same thing works here for the below code
function diffArray(arr1, arr2) {
return arr1
.concat(arr2)
.filter(item => !arr1.includes(item) || !arr2.includes(item));
}
diffArray([1, 2, 3, 5], [1, 2, 3, 4, 5]);
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36
.
Challenge: Seek and Destroy
Link to the challenge:
https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/seek-and-destroy