Hello!, I want to push the elements of the next array in the args in the newArr.
I could filtered the newArr,
But, How can I introduce the elements which are not included in the newArr.
function sym(...args) {
let newArr=[];
let arr0=args[0];
let arr1=args[1];
let lengthOfArgs=args.length;
if(lengthOfArgs==2){
for(let i=0;i<arr1.length;i++){
if(!arr0.includes(arr1[i]) && !newArr.includes(arr1[i]) ){
newArr.push(arr1[i])
}
}
for(let i=0;i<arr0.length;i++){
if(!arr1.includes(arr0[i]) && !newArr.includes(arr0[i]) ){
newArr.push(arr0[i])
}
}
return newArr.sort((a,b)=>a-b)
}else{
for(let i=0;i<arr1.length;i++){
if(!arr0.includes(arr1[i]) && !newArr.includes(arr1[i]) ){
newArr.push(arr1[i])
}
}
for(let i=0;i<arr0.length;i++){
if(!arr1.includes(arr0[i]) && !newArr.includes(arr0[i]) ){
newArr.push(arr0[i])
}
}
for(let i=2;i<args.length;i++){
for(let j=0;i<newArr.length;j++){
if(args[i].includes(newArr[j])){
newArr=newArr.filter(e=>!args[i].includes(e))
}else{
newArr=newArr.push(args[i][j])
}
//if(!newArr.includes(args[i][j])){
// newArr.push(newArr[i][j])
//}
}
}
}
}
sym([3, 3, 3, 2, 5], [2, 1, 5, 7], [3, 4, 6, 6], [1, 2, 3], [5, 3, 9, 8], [1]);