Seek and Destroy //Duplicate elements

Seek and Destroy //Duplicate elements
0.0 0


How do i remove the duplicate elements?

Your code so far

function destroyer(arr) {
  var arr1;
  return arr;

destroyer([1, 2, 3, 1, 2, 3], 2, 3);

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36.

Link to the challenge:


Your filter function does nothing with x. Also, with return arr, you are just returning the the first argument (in this example, that would be the array [1,2,3,1,2,3]). You are also not referencing the other destroyer function arguments (in the example shown, I am referring to the 2nd argument with the value 2 and the 3rd argument with the value of 3). You could use the arguments object to reference these values and figure out a way to use the x argument of the filter callback function.

You may need to step back and think what your algorithm needs to be before trying to use functions such as filter. The challenge suggests using filter, but you could use a for or while loop and accomplish the same thing.