如何使用 Lodash 获取 2 个数组之间不相交的值?

How to get which do not intersect value between 2 Array with Lodash?

如何使用 Lodash 获取两个数组之间不相交的值?

预期:

const arr1 = [1, 2, 3]
const arr2 = [2, 3, 4]

console.log(unintersection(arr1, arr2))

输出

[1, 4]

使用 _.xor() to find the symmetric difference - 一个数组中的数字,但不是两个数组中的数字:

const arr1 = [1, 2, 3]
const arr2 = [2, 3, 4]

const result = _.xor(arr1, arr2)

console.log(result)
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.20/lodash.min.js"></script>