I am not really going to answer your question, because I assume you want to be able to pass the tests, which means you will need to change a lot more of your code than this one line.
You have far too much hard coding in your script. So, I am not sure if you plan on keeping most of it, but I suggest you reset the code, and start again.
To this particular line:
The filter method does not alter the array. It returns a new array. So, this line is just returning a new array, and doing nothing with it.
Also, your function does not return anything. So, it will definitely not pass the tests.
I suggest you start with that, and return with updated code, and a new question. Otherwise, I recommend going through the JavaScript section of the curriculum once more.
How can I do with those groups? Because they make the pivotGroup, the functions works with that.
What can I do to elimanate the duplicate? I jave just read methods that employs “hard code”
I think I solved the problem with push.
function sym(...args) {
let firstGroup=args[0];
let secondGroup=args[1];
let pivotGroup=[];
let lengthOfargs=args.length;
//console.log(lengthOfargs)
if(lengthOfargs==2){
for(let i = 0;i<firstGroup.length;i++){
if(!secondGroup.includes(firstGroup[i]) && !pivotGroup.includes(firstGroup[i])){
pivotGroup.push(firstGroup[i])
}
}
for(let i = 0;i<secondGroup.length;i++){
if(!firstGroup.includes(secondGroup[i]) && !pivotGroup.includes(secondGroup[i])){
pivotGroup.push(secondGroup[i])
}
}
//console.log(pivotGroup)
//return pivotGroup
}else{
for(let i=2;i<args.length;i++){
for(let j=0;j<args[i].length;j++){
if(pivotGroup.includes(args[i][j])){
pivotGroup=pivotGroup.filter(e=>e!=args[i][j])
}else{
pivotGroup.push(args[i][j])
}
}
}
//console.log(pivotGroup)
//return pivotGroup
}
}
sym([1, 2, 3], [5, 2, 1, 4]);