Seek and Destroy with filter

Seek and Destroy with filter
0.0 0


I want to solve this with filter instead of for loop i am not able to use filter need some help

function destroyer(arr, ...arg) {
let newarr=[];
var pro;
for(let j=0;j<arr.length;j++)
for(let i=0;i<arg.length;i++)
  else {pro=false;break;}
return newarr;

console.log(destroyer([1, 2, 3, 1, 2, 3], 2, 3));

Link to the challenge:


What have you tried when it comes to using a filter? What part gets you stuck?


i did like this

let newarr=arr.filter(a=>a!=arg);

and some other stuffs too


That would compare every element of the arr array to arg, which is different logic than you are currently using.


tell me how can i compare every element of arr with every element of arg using filter


@coderharshit Read about the every function.


yes i think i have to work on it :slight_smile: