Callback function confusion, Seek and Destroy

The first array is filtered in a search for arr elements that not found in targets. It seems that filter is not working. What is incorrect?

function destroyer(array, ...iv) {
  let targets = [...iv];
  let arr = [...array];
  arr.filter(element => {
    return !arr.indexOf(element);
  });
  return arr;
}
 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/88.0.4324.96 Safari/537.36 Edg/88.0.705.56.

Challenge: Seek and Destroy

Link to the challenge:

The return part of the callback can search targets.
return !targets.indexOf(element);

.filter() does not modify the array. It returns a new array.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter

Thank you. Let me rework something.

function destroyer(array, ...iv) {
  let targets = [...iv];
  let arr = [...array];
  let result = arr.filter(element => {
    return targets.indexOf(element) === -1;
  });
  return result;
}
 destroyer([1, 2, 3, 1, 2, 3], 2, 3);

Pikachu accepts me! I have at last made my own solution for this challenge.

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

Challenge Seek and Destroy
Learn Intermediate Algorithm Scripting: Seek and Destroy | freeCodeCamp.org