I am asked to process two or more arrays sent from a function. But the function only sends one argument. I do not know if the problem is wrongly formulated or if it is really possible to do so. This is what I have done so far:
function uniteUnique(arr) {
var newArr=[];
var args = Array.from(arr);
for(i=0;i<arr.length;i++){
if(Array.isArray(arr[i])){
for(j=0;j<arr[i].length;j++){
if(!newArr.includes(arr[i][j])){
newArr.push(arr[i][j]);
}
}
}else{
newArr.push(arr[i]);
}
}
return newArr;
}
uniteUnique([1, 3, 2], [5, 2, 1, 4], [2, 1]);