Seek and Destroy : is it valid

Seek and Destroy : is it valid
0

#1

Tell us what’s happening:

passed the test but inserted rest parameter as an argument.

Your code so far


function destroyer(arr, ...rr) {
  // Remove all the values
   let rs = arr.concat(rr)
  let rt = rs.filter(a=>{
     if(rr.indexOf(a) ==-1){
       return a
     }
   })
    console.log(rt);
   return rt

}

Your browser information:

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

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/seek-and-destroy


#2

It’s a valid way to solve the problem, but I would encourage you to give this challenge another shot and try solving it with the constraints that you are given. Working with what you’ve got rather than what you want is a common problem when it comes to problem solving with code.


#3

ok i will give it a try