Tell us what’s happening:
I tried my code line by line in the Chrome console and it works fine. I believe my issue is I am failing to pass the initial argument “arr” into a actual array (realArr) so that I can apply the filter method. Any tips? Thank you!
Your code so far
function destroyer(arr) {
// Remove all the values
let realArr = [arr];
console.log(realArr);
let remains = realArr[0];
for (let i = 1; i < realArr.length; i++){
remains = remains.filter((x) => x != realArr[i]);
console.log(remains);
}
return remains;
}
destroyer([1, 2, 3, 1, 2, 3], 2, 3);
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/seek-and-destroy/