Skip to content

Instantly share code, notes, and snippets.

@AIndoria
Created April 17, 2018 04:44
Show Gist options
  • Select an option

  • Save AIndoria/6418125fb56ac40c3dec875f0476e3a4 to your computer and use it in GitHub Desktop.

Select an option

Save AIndoria/6418125fb56ac40c3dec875f0476e3a4 to your computer and use it in GitHub Desktop.
function diffArray(...arrs){
let newArray=[];
arrs.forEach(function(element){
element.forEach(function(newElement){
newArray.push(newElement);
});
});
let result=newArray.filter(function(element){
return !arrs[0].includes(element);
});
let result2=newArray.filter(function(element){
return !arrs[1].includes(element)
});
return result.concat(result2);
}
diffArray([1,4,5,8], [1,2,3]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment