Tell us what’s happening:
**Your code so far**
function sym(...args) {
let temp = [];
for (var arg of args[0]) {
if(args[1].includes(arg)){
while(args[1].includes(arg))
args[1].splice(args[1].indexOf(arg),1);
continue;
}
else {
if(!temp.includes(arg))
temp.push(arg);
}
}
for (var arg of args[1]) {
if(!temp.includes(arg))
temp.push(arg);
}
args.splice(0,2);
args.unshift(temp);
if (args.length > 1) {
sym(...args)
}
if (args.length == 1) {
temp.sort(function (a, b) {
return a - b;
});
console.log(temp)
return temp;
}
}
sym([1, 2, 5], [2, 3, 5], [3, 4, 5]);
**Your browser information:**
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36
.
Challenge: Find the Symmetric Difference
Link to the challenge: