Tell us what’s happening:
used spread operator access the arguments.
When I filter the newArr nothing happens and I am returned with same array.
Can somebody please help me , why the filter is not working ?
Your code so far
function destroyer(...arr) {
// Remove all the values
//used spread operator to access the arguments
let dest = arr.slice(1);
let newArr = arr.slice(0,1);
//using filter to remove elements in newArr which are present in dest
return newArr.filter((item) => !dest.includes(item));
}
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/67.0.3396.99 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/seek-and-destroy