var a = [1,2,3,4,5,6,7]
var b = [1,2,3,4,5,6]
var result = []
function result(...arg){
var mapka = new Map();
arg.forEach(arr=>{
arr.forEach(item=>{
if(mapka.has(item)){
let value = mapka.get(item) +1;
mapka.set(item,value) ;
}else{
mapka.set(item,1);
}
})
});
return Array.from(mapka).reduce((acc,item) =>item[1] == 1 ?[...acc,item[0]] : [...acc],[]);
}
var a = [1, 2, 3, 4, 5, 6, 7];
var b = [1, 2, 3, 4, 5, 6];
result(a,b);// [7];