📜  返回数组javascript代码示例的对称差

📅  最后修改于: 2022-03-11 15:01:31.150000             🧑  作者: Mango

代码示例2
function symmetricDiff(arrary1, array2){
 let symmetricDifference = []; 
  
 symmetricDifference = array1.filter(element => !array2.includes(element))
   .concat(array2.filter(element => !array1.includes(element)))
 return symmetricDifference;
}