Answers for "how to get the difference of two arrays in javascrpt"

15

javascript difference between two arrays

let difference = arr1.filter(x => !arr2.includes(x));
Posted by: Guest on April-03-2020
0

return symmetric difference of the array javascript

function symmetricDiff(arrary1, array2){
 let symmetricDifference = []; 
  
 symmetricDifference = array1.filter(element => !array2.includes(element))
   .concat(array2.filter(element => !array1.includes(element)))
 return symmetricDifference;
}
Posted by: Guest on November-18-2020

Code answers related to "how to get the difference of two arrays in javascrpt"

Code answers related to "Javascript"

Browse Popular Code Answers by Language