I’m getting stacked in an issue in JavaScript.
I have two arrays and I want to check if they intersect on some elements then delete those elements and return new array without the intersected elements.
example :
Array A (
[0] => 0 [1] => 1
)
Array B (
[0] => 2 [1] => 1
)
I want to check them and return:
Array result (
[0] => 0 [1] => 2
)
How can i do this in JavaScript?
Checkout the library underscore.js.
Say you have two arrays,
First find the union.
Then find the intersection.
The final answer should be the difference between the union, and the intersection.