Skip to content

Instantly share code, notes, and snippets.

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

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

Select an option

Save AIndoria/b934f1051dab178b26ea682d0a4a5fee to your computer and use it in GitHub Desktop.
finArray=[];
function diffArray(...arrs){
var newArray=[...arrs[0],...arrs[1]];
arrs[0].forEach(function(element){
if(newArray.indexOf(element)==-1){
finArray.push(element);
}
});
arrs[1].forEach(function(element){
if(newArray.indexOf(element)==-1){
finArray.push(element);
}
});
return finArray;
}
diffArray([1,3,5,9],[1,2,3,4,5,6,7]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment