tell me the best way to get value which doesn’t intersect between 2 arrays?

Use _.xor() to find the symmetric difference – the numbers that are in one of the arrays, but not both:

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>

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top