loading...

Seek and Destroy

95freedom95 profile image Oscar Hernandez ・1 min read

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

Posted on by:

95freedom95 profile

Oscar Hernandez

@95freedom95

I AM oriented to learn new things, student at Free code camp.

Discussion

markdown guide