Tell us what’s happening:
Your code so far
function destroyer(arr) {
// Remove all the values
// console.log(arguments)
let be= Array.from(arguments)
let args= be.splice(1,6)
// console.log(args)
let total=[];
for(let i=0; i<arr.length; i++){
if(args.indexOf(arr[i])===-1){
total.push(arr[i])
}
for(let j=0; j<args.length; j++){
if(arr.indexOf(args[j])===-1){
total.push(args[j])
}
}
console.log(total)
}
return total;
}
destroyer(["possum", "trollo", 12, "safari", "hotdog", 92, 65, "grandma", "bugati", "trojan", "yacht"], "yacht", "possum", "trollo", "safari", "hotdog", "grandma", "bugati", "trojan");
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.120 Safari/537.36
.
Challenge: Seek and Destroy
Link to the challenge:
https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/seek-and-destroy