Tell us what’s happening:
Hi, I’m not sure what in my code would give me the output that I am getting. This code with this sample produces an output of 13131212. Could someone please point me in the right direction?
Thank you
Your code so far
function destroyer(arr) {
// Remove all the values
var newArr = [];
for(var i = 1;arguments.length>i;i++) //goes through extra numbers after the first array in arguments
{
for(var j = 0;arr.length>j;j++) ///goes through the array in arguments and removes matching numbers
{
if(arguments[i] != arr[j]){newArr += arr[j];}
//console.log(newArr);
}
}
return newArr;
}
destroyer([1, 2, 3, 1, 2, 3], 2, 3);
Your browser information:
Your Browser User Agent is: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.101 Safari/537.36
.
Link to the challenge: