Feedback for solution Intermediate Algorithm - Seek and Destroy

Tell us what’s happening:
Describe your issue in detail here.
I solved this algorithm by make a change in the arguments of the function by the spread operator is this acceptable to change the function itself to solve the problem or its better to solve it in another way ? because when i looked at the solutions in the hint section i didn’t find something like that .

  **Your code so far**
function destroyer(...arr) {
let newArr =[];
newArr = arr[0];
for(let i=1 ; i < arr.length ; i++){
  newArr =newArr.filter(input => input != arr[i]);
return newArr;

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/ Safari/537.36

Challenge: Intermediate Algorithm Scripting - Seek and Destroy

Link to the challenge:

I think the point of that exercise is to understand the arguments object so I’d recommend reading about that and trying again without changing the function.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.