DEV Community

Oscar Hernandez
Oscar Hernandez

Posted on

Seek and Destroy

function destroyer(arr) {
// Remove all the values
var args =[]; var p =[]; var odd=[];
for(let i=0; i<arguments.length; i++){
args.push(arguments[i])
}
var p = arr.filter(function(item){
return args.indexOf(item)===-1;
})
console.log(p)
return p

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

/*destroyer([1, 2, 3, 1, 2, 3], 2, 3) should return [1, 1].

destroyer([1, 2, 3, 5, 1, 2, 3], 2, 3) should return [1, 5, 1].

destroyer([3, 5, 1, 2, 2], 2, 3, 5) should return [1].

destroyer([2, 3, 2, 3], 2, 3) should return [].

destroyer(["tree", "hamburger", 53], "tree", 53) should return ["hamburger"].

destroyer(["possum", "trollo", 12, "safari", "hotdog", 92, 65, "grandma", "bugati", "trojan", "yacht"], "yacht", "possum", "trollo", "safari", "hotdog", "grandma", "bugati", "trojan") should return [12,92,65].*/

?signin=true

Top comments (0)