如何獲取JavaScript中兩個數組之間的差別? - How to get the difference between two arrays in JavaScript?

問題:

Is there a way to return the difference between two arrays in JavaScript? 有沒有辦法返回JavaScript中兩個數組之間的差? 數組

For example: 例如: ide

var a1 = ['a', 'b'];
var a2 = ['a', 'b', 'c', 'd'];

// need ["c", "d"]

解決方案:

參考一: https://stackoom.com/question/4yvW/如何獲取JavaScript中兩個數組之間的差別
參考二: https://oldbug.net/q/4yvW/How-to-get-the-difference-between-two-arrays-in-JavaScript
相關文章
相關標籤/搜索